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