KickJava   Java API By Example, From Geeks To Geeks.

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


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 // Zeus imports
22
import java.util.BitSet JavaDoc;
23 import java.util.Vector JavaDoc;
24
25 /**
26  * <p>
27  * <code>AtomicProperty</code> implements the
28  * <code>{@link org.enhydra.zeus.Binding}</code> and
29  * <code>{@link Property}</code> interfaces, and provides
30  * for a simple name/value property representation.
31  * </p><p>
32  * An <code>AtomicProperty</code> will most commonly represent
33  * simple typed values in Java, such as a <code>String</code>,
34  * <code>int</code>, or <code>Date</code>.
35  * </p>
36  *
37  * @author Brett McLaughlin
38  * @author Steve Witten
39  * @author Maciej Zawadzki
40  * @author Sean Ogle
41  */

42 public class AtomicProperty extends BaseProperty {
43     
44     /** Default modifier for properties */
45     private static BitSet JavaDoc DEFAULT_MODIFIER = new BitSet JavaDoc();
46     
47     static {
48         DEFAULT_MODIFIER.set(Property.ACCESS_PRIVATE);
49     }
50
51     /**
52      * <p>
53      * This will create a new <code>AtomicProperty</code> with
54      * the specified information.
55      * </p>
56      *
57      * @param xmlName the <code>String</code> XML name of this property.
58      * @param xmlNamespaceURI the XML namespace URI associated with the
59      * property's XML name.
60      * @param xmlType the XML type associated with the property.
61      * @param xmlTypeNamespaceURI the XML namespace URI associated with the
62      * property's XML type.
63      * @param modifier the <code>int<code> constant for the
64      * property's access modifier.
65      * @param enumeration the vector of possible values for this property.
66      * @param defaultValue the default value for this property.
67      *
68      * @see <code>{@link Property#ACCESS_PRIVATE}</code>
69      * @see <code>{@link Property#ACCESS_PROTECTED}</code>
70      * @see <code>{@link Property#ACCESS_PUBLIC}</code>
71      * @see <code>{@link Property#STORAGE_STATIC}</code>
72      * @see <code>{@link Property#MUTABILITY_VOLATILE}</code>
73      * @see <code>{@link Property#MUTABILITY_FINAL}</code>
74      */

75     public AtomicProperty(String JavaDoc xmlName,
76                           String JavaDoc xmlNamespaceURI,
77                           String JavaDoc xmlType,
78                           String JavaDoc xmlTypeNamespaceURI,
79                           BitSet JavaDoc modifier,
80                           Vector JavaDoc enumeration,
81                           Object JavaDoc defaultValue) {
82         super();
83
84         // Error checking
85
if (xmlName == null) {
86             throw new IllegalArgumentException JavaDoc("An AtomicProperty cannot " +
87                 "have a null XML name.");
88         }
89         if (xmlNamespaceURI == null) {
90             throw new IllegalArgumentException JavaDoc("An AtomicProperty cannot " +
91                 "have a null XML namespace URI. To specify no namespace URI, " +
92                 "use the empty String (\"\")");
93         }
94         if (xmlType == null) {
95             throw new IllegalArgumentException JavaDoc("An AtomicProperty cannot " +
96                 "have a null XML type.");
97         }
98         if (xmlTypeNamespaceURI == null) {
99             throw new IllegalArgumentException JavaDoc("An AtomicProperty cannot " +
100                 "have a null XML type namespace URI. To specify no namespace " +
101                 "URI, use the empty String (\"\")");
102         }
103         if (modifier == null) {
104             throw new IllegalArgumentException JavaDoc("A Binding cannot have a " +
105                 "null set of modifiers.");
106         }
107         
108         this.xmlName = xmlName;
109         this.xmlNamespaceURI = xmlNamespaceURI;
110         this.xmlType = xmlType;
111         this.xmlTypeNamespaceURI = xmlTypeNamespaceURI;
112         this.modifier = modifier;
113         this.enumeration = enumeration;
114         this.defaultValue = defaultValue;
115     }
116
117     /**
118      * <p>
119      * This will create a new AtomicProperty with the specified information.
120      * The modifier will be set to ACCESS_PRIVATE, the default value and the
121      * enumeration will be set to null.
122      * </p>
123      *
124      * @param xmlName the <code>String</code> XML name of this property.
125      * @param xmlNamespaceURI the XML namespace URI associated with the
126      * property's XML name.
127      * @param xmlType the XML type associated with the property.
128      * @param xmlTypeNamespaceURI the XML namespace URI associated with the
129      * property's XML type.
130      *
131      * @see <code>{@link Property#ACCESS_PRIVATE}</code>
132      * @see <code>{@link Property#ACCESS_PROTECTED}</code>
133      * @see <code>{@link Property#ACCESS_PUBLIC}</code>
134      * @see <code>{@link Property#STORAGE_STATIC}</code>
135      * @see <code>{@link Property#MUTABILITY_VOLATILE}</code>
136      * @see <code>{@link Property#MUTABILITY_FINAL}</code>
137      */

138     public AtomicProperty(String JavaDoc xmlName,
139                           String JavaDoc xmlNamespaceURI,
140                           String JavaDoc xmlType,
141                           String JavaDoc xmlTypeNamespaceURI) {
142         this(xmlName, xmlNamespaceURI, xmlType, xmlTypeNamespaceURI,
143              DEFAULT_MODIFIER, null, null);
144     }
145     
146     /**
147      * <p>
148      * This will create a new AtomicProperty with the specified information.
149      * The modifier will be set to ACCESS_PRIVATE, the default value and the
150      * enumeration will be set to null, and both the XML name and XML type
151      * namespaces are set to an empty string, the equivalent of no namespace.
152      * </p>
153      *
154      * @param xmlName the <code>String</code> XML name of this property.
155      * @param xmlType the XML type associated with the property.
156      *
157      * @see <code>{@link Property#ACCESS_PRIVATE}</code>
158      * @see <code>{@link Property#ACCESS_PROTECTED}</code>
159      * @see <code>{@link Property#ACCESS_PUBLIC}</code>
160      * @see <code>{@link Property#STORAGE_STATIC}</code>
161      * @see <code>{@link Property#MUTABILITY_VOLATILE}</code>
162      * @see <code>{@link Property#MUTABILITY_FINAL}</code>
163      */

164     public AtomicProperty(String JavaDoc xmlName,
165                           String JavaDoc xmlType) {
166         this(xmlName, "", xmlType, "",
167              DEFAULT_MODIFIER, null, null);
168     }
169 }
170
Popular Tags