KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > betwixt > DynaWithDotBetwixt


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: 1.4 $
28   */

29 public class DynaWithDotBetwixt implements DynaBean {
30     
31     private String JavaDoc notDynaProperty;
32     private String JavaDoc dynaProperty;
33     
34     public DynaWithDotBetwixt() {
35         this("DEFAUL_NOT_DYNA", "DEFAULT_DYNA");
36     }
37      
38     
39     public DynaWithDotBetwixt(String JavaDoc notDynaProperty, String JavaDoc dynaProperty) {
40         this.notDynaProperty = notDynaProperty;
41         this.dynaProperty = dynaProperty;
42     }
43     
44     public String JavaDoc getNotDynaProperty() {
45         return notDynaProperty;
46     }
47     
48     public String JavaDoc fiddleDyna() {
49         return dynaProperty;
50     }
51     
52     public boolean contains(String JavaDoc name, String JavaDoc key) {
53         return false;
54     }
55     
56     public Object JavaDoc get(String JavaDoc name) {
57         return dynaProperty;
58     }
59     
60     public Object JavaDoc get(String JavaDoc name, int index) {
61         return dynaProperty;
62     }
63     
64     public Object JavaDoc get(String JavaDoc name, String JavaDoc 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 JavaDoc.class)};
72                 return properties;
73             }
74             
75             public String JavaDoc getName() {
76                 return "DynaWithDotBetwixtClass";
77             }
78             
79             public DynaBean newInstance() {
80                 return new DynaWithDotBetwixt();
81             }
82             
83             public DynaProperty getDynaProperty(String JavaDoc name) {
84                 if ("DynaProp".equals(name)) {
85                     return new DynaProperty("DynaProp", String JavaDoc.class);
86                 }
87                 return null;
88             }
89         };
90     }
91     
92     public void remove(String JavaDoc name, String JavaDoc key) {}
93     
94     public void set(String JavaDoc name, Object JavaDoc value) {}
95     
96     public void set(String JavaDoc name, int index, Object JavaDoc value) {}
97     
98     public void set(String JavaDoc name, String JavaDoc key, Object JavaDoc value) {}
99
100 }
101
102
Popular Tags