KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > zeus > binding > Property


1 /*
2  * Enhydra Java Application Server Project
3  *
4  * The contents of this file are subject to the Enhydra Public License
5  * Version 1.1 (the "License"); you may not use this file except in
6  * compliance with the License. You may obtain a copy of the License on
7  * the Enhydra web site ( http://www.enhydra.org/ ).
8  *
9  * Software distributed under the License is distributed on an "AS IS"
10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
11  * the License for the specific terms governing rights and limitations
12  * under the License.
13  *
14  * The Initial Developer of the Enhydra Application Server is Lutris
15  * Technologies, Inc. The Enhydra Application Server and portions created
16  * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
17  * All Rights Reserved.
18  */

19 package org.enhydra.zeus.binding;
20
21 import java.util.BitSet JavaDoc;
22 import java.util.Vector JavaDoc;
23
24 // Zeus imports
25
import org.enhydra.zeus.Binding;
26
27 /**
28  * <p>
29  * <code>Property</code> implements the <code>{@link Binding}</code>
30  * interface and defines behavior for a property of a Java class.
31  * These properties have modifiers, types, and names, as well
32  * as a value.
33  * </p>
34  *
35  * @author Brett McLaughlin
36  * @author Steve Witten
37  * @author Maciej Zawadzki
38  */

39 public interface Property extends Binding {
40
41     /** Access Modifier: <code>private</code> */
42     public static final int ACCESS_PRIVATE = 1;
43
44     /** Access Modifier: <code>private</code> */
45     public static final int ACCESS_PROTECTED = 2;
46     
47     /** Access Modifier: <code>public</code> */
48     public static final int ACCESS_PUBLIC = 3;
49
50     /** Storage Modifier: <code>static</code> */
51     public static final int STORAGE_STATIC = 4;
52     
53     /** Mutability Modifier: <code>volatile</code> */
54     public static final int MUTABILITY_VOLATILE = 5;
55     
56     /** Mutability Modifier: <code>final</code> */
57     public static final int MUTABILITY_FINAL = 6;
58     
59     /** Mutability Modifier: <code>synchronized</code> */
60     public static final int MUTABILITY_SYNCHRONIZED = 7;
61     
62     /** Mutability Modifier: <code>transient</code> */
63     public static final int MUTABILITY_TRANSIENT = 8;
64
65     /** The source of the property; in this case, an attribute */
66     public static final int SOURCE_ATTLIST = 9;
67
68     /** The source of the property; in this case, an element */
69     public static final int SOURCE_ELEMENT = 10;
70
71     /**
72      * <p>
73      * This will set the modifier for a property. The
74      * value submitted must be in the form of a <code>BitSet</code>,
75      * in which the set bits correspond to the constants defined
76      * (<code>{@link #ACCESS_PRIVATE}</code>,
77      * <code>{@link #ACCESS_PROTECTED}</code>,
78      * <code>{@link #ACCESS_PUBLIC}</code>,
79      * <code>{@link #STORAGE_STATIC}</code>,
80      * <code>{@link #MUTABILITY_VOLATILE}</code>,
81      * <code>{@link #MUTABILITY_FINAL}</code> or
82      * <code>{@link #MUTABILITY_SYNCHRONIZED}</code>). By default,
83      * all properties will be <code>private</code>
84      * (<code>ACCESS_PRIVATE</code>).
85      * </p>
86      *
87      * @param modifier <code>int</code> constant for access level.
88      * @see #ACCESS_PRIVATE
89      * @see #ACCESS_PROTECTED
90      * @see #ACCESS_PUBLIC
91      * @see #STORAGE_STATIC
92      * @see #MUTABILITY_VOLATILE
93      * @see #MUTABILITY_FINAL
94      * @see #MUTABILITY_SYNCHRONIZED
95      */

96     public void setModifier(BitSet JavaDoc modifier);
97     
98     /**
99      * <p>
100      * This will return the modifier for a property.The
101      * value returned will be in the form of a <code>BitSet</code>,
102      * in which the set bits correspond to the constants defined
103      * (<code>{@link #ACCESS_PRIVATE}</code>,
104      * <code>{@link #ACCESS_PROTECTED}</code>,
105      * <code>{@link #ACCESS_PUBLIC}</code>,
106      * <code>{@link #STORAGE_STATIC}</code>,
107      * <code>{@link #MUTABILITY_VOLATILE}</code>,
108      * <code>{@link #MUTABILITY_FINAL}</code> or
109      * <code>{@link #MUTABILITY_SYNCHRONIZED}</code>). By default,
110      * all properties will be <code>private</code>
111      * (<code>ACCESS_PRIVATE</code>).
112      * </p>
113      *
114      * @return <code>BitSet</code> - the constant(s) for access level.
115      * @see #ACCESS_PRIVATE
116      * @see #ACCESS_PROTECTED
117      * @see #ACCESS_PUBLIC
118      * @see #STORAGE_STATIC
119      * @see #MUTABILITY_VOLATILE
120      * @see #MUTABILITY_FINAL
121      * @see #MUTABILITY_SYNCHRONIZED
122      */

123     public BitSet JavaDoc getModifier();
124     
125     /**
126      * <p>
127      * This will return the Java <code>String</code> representation
128      * of this <code>Property</code>'s modifier. For
129      * example, <code>{@link #ACCESS_PRIVATE}</code> would be
130      * converted to "private".
131      * </p>
132      *
133      * @return <code>String</code> - character constant(s) for access level.
134      * @see #ACCESS_PRIVATE
135      * @see #ACCESS_PROTECTED
136      * @see #ACCESS_PUBLIC
137      * @see #STORAGE_STATIC
138      * @see #MUTABILITY_VOLATILE
139      * @see #MUTABILITY_FINAL
140      * @see #MUTABILITY_SYNCHRONIZED
141      */

142     public String JavaDoc getModifierString();
143     
144     /**
145      * <p>
146      * This will whether or not this <code>Property</code>
147      * is a <code>Collection</code> (in other words, the property
148      * represents a collection of values). By default, properties
149      * are all singular values.
150      * </p>
151      *
152      * @param isCollection <code>true</code> if multiple values can be stored,
153      * or else <code>false</code>.
154      */

155     public void setIsCollection(boolean isCollection);
156     
157     /**
158      * <p>
159      * This will indicate whether this <code>Property</code> represents
160      * a <code>Collection</code> of values (resulting in a <code>true</code>
161      * result from this method), or a singular value (resulting in a
162      * <code>false</code> result).
163      * </p>
164      *
165      * @return <code>boolean</code> - whether or not this <code>Property</code>
166      * represents a <code>Collection<code>.
167      */

168     public boolean isCollection();
169
170     /**
171      * <p>
172      * This indicates whether or not this <code>Property</code> has a
173      * a default value set.
174      * </p>
175      *
176      * @return <code>boolean</code> - whether there is a default value set.
177      */

178     public boolean hasDefaultValue();
179     
180     /**
181      * <p>
182      * This will set the default value of the property. Since no typing
183      * is available at this point, a simple Java <code>Object</code>
184      * is allowed as the type supplied. As a result, any errors in
185      * mismatches between object type and allowed paramater type will
186      * occur at runtime, when class generation takes place. Supplying
187      * a value here essentially results in:
188      * <code><pre>
189      * public class Foo {
190      *
191      * private String myString = "some default value";
192      *
193      * public String getMyString() {
194      * return myString;
195      * }
196      *
197      * public void setMyString(String myString) {
198      * this.myString = myString;
199      * }
200      *
201      * // Other methods and properties
202      * }
203      * </pre></code>
204      * </p><p>
205      * Also, note that data binding users who supply their own class
206      * implementations will <b>LOSE THIS DEFAULT VALUE</b>, as the interface
207      * alone cannot specify a default value. So use this carefully!
208      * </p>
209      *
210      * @param defaultValue <code>Object</code> to be used as default value.
211      */

212     public void setDefaultValue(Object JavaDoc defaultValue);
213     
214     /**
215      * <p>
216      * This will retrieve the default value associated with this property,
217      * or <code>null</code> if there is not one. For more information on
218      * default property values, see
219      * <code>{@link #setDefaultValue(Object)}</code>.
220      * </p>
221      *
222      * @return <code>Object</code> - default value of the property.
223      */

224     public Object JavaDoc getDefaultValue();
225     
226     /**
227      * <p>
228      * This will indicate if this <code>Property</code> has a set of
229      * allowed values (an enumeration) specified for it.
230      * </p>
231      *
232      * @return <code>boolean</code> - whether an enumeration is specified.
233      */

234     public boolean hasEnumeration();
235
236     /**
237      * <p>
238      * This will set a list (enumeration) of allowed values for this
239      * <code>Property</code>.
240      * </p>
241      *
242      * @param enumeration the <code>Vector</code> of allowed values.
243      */

244     public void setEnumeration(Vector JavaDoc enumeration);
245    
246     /**
247      * <p>
248      * This returns the <code>Vector</code> of allowed values for this
249      * <code>Property</code>, or <code>null</code> if there is none.
250      * </p>
251      *
252      * @return <code>Vector</code> - the allowed values.
253      */

254     public Vector JavaDoc getEnumeration();
255         
256 }
257
Popular Tags