1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    * 
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   * 
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */ 
17   
18  package org.apache.commons.betwixt;
19  
20  import org.apache.commons.beanutils.DynaBean;
21  import org.apache.commons.beanutils.DynaClass;
22  import org.apache.commons.beanutils.DynaProperty;
23  
24  
25  /** <p>Test bean which extends DynaBean but has a .betwixt file.</p>
26    *
27    * @author Robert Burrell Donkin
28    * @version $Revision: 438373 $
29    */
30  public class DynaWithDotBetwixt implements DynaBean {
31      
32      private String notDynaProperty;
33      private String dynaProperty;
34      
35      public DynaWithDotBetwixt() {
36          this("DEFAUL_NOT_DYNA", "DEFAULT_DYNA");
37      }
38       
39      
40      public DynaWithDotBetwixt(String notDynaProperty, String dynaProperty) {
41          this.notDynaProperty = notDynaProperty;
42          this.dynaProperty = dynaProperty;
43      }
44      
45      public String getNotDynaProperty() {
46          return notDynaProperty;
47      }
48      
49      public String fiddleDyna() {
50          return dynaProperty;
51      }
52      
53      public boolean contains(String name, String key) {
54          return false;
55      }
56      
57      public Object get(String name) {
58          return dynaProperty;
59      }
60      
61      public Object get(String name, int index) {
62          return dynaProperty;
63      } 
64      
65      public Object get(String name, String key) {
66          return dynaProperty;
67      }
68      
69      public DynaClass getDynaClass() {
70          return new DynaClass() {
71              public DynaProperty[] getDynaProperties() {
72                  DynaProperty[] properties = {new DynaProperty("DynaProp", String.class)};
73                  return properties;
74              }
75              
76              public String getName() {
77                  return "DynaWithDotBetwixtClass";
78              }
79              
80              public DynaBean newInstance() {
81                  return new DynaWithDotBetwixt();
82              }
83              
84              public DynaProperty getDynaProperty(String name) {
85                  if ("DynaProp".equals(name)) {
86                      return new DynaProperty("DynaProp", String.class);
87                  }
88                  return null;
89              }	 
90          };
91      }
92      
93      public void remove(String name, String key) {}
94      
95      public void set(String name, Object value) {}
96      
97      public void set(String name, int index, Object value) {}
98      
99      public void set(String name, String key, Object value) {}
100 
101 }  
102