KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > ldap > server > tools > schema > AttributeTypeLiteral


1 /*
2  * Copyright 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.ldap.server.tools.schema;
18
19
20 import org.apache.ldap.common.util.ArrayUtils;
21 import org.apache.ldap.common.schema.UsageEnum;
22
23
24 /**
25  * A bean used to hold the literal values of an AttributeType parsed out of an
26  * OpenLDAP schema configuration file.
27  *
28  * @author <a HREF="mailto:dev@directory.apache.org">Apache Directory Project</a>
29  * @version $Rev: 169198 $
30  */

31 public class AttributeTypeLiteral
32 {
33     private boolean obsolete = false;
34     private boolean singleValue = false;
35     private boolean collective = false;
36     private boolean noUserModification = false;
37
38     private final String JavaDoc oid;
39     private String JavaDoc description;
40     private String JavaDoc superior;
41     private String JavaDoc equality;
42     private String JavaDoc ordering;
43     private String JavaDoc substr;
44     private String JavaDoc syntax;
45
46     private UsageEnum usage = UsageEnum.USERAPPLICATIONS;
47
48     private String JavaDoc[] names = ArrayUtils.EMPTY_STRING_ARRAY;
49
50     private int length = -1;
51
52
53     // ------------------------------------------------------------------------
54
// C O N S T R U C T O R S
55
// ------------------------------------------------------------------------
56

57
58     public AttributeTypeLiteral( String JavaDoc oid )
59     {
60         this.oid = oid;
61     }
62
63
64     // ------------------------------------------------------------------------
65
// Accessors and mutators
66
// ------------------------------------------------------------------------
67

68
69     public boolean isObsolete()
70     {
71         return obsolete;
72     }
73
74     public void setObsolete( boolean obsolete )
75     {
76         this.obsolete = obsolete;
77     }
78
79     public boolean isSingleValue()
80     {
81         return singleValue;
82     }
83
84     public void setSingleValue( boolean singleValue )
85     {
86         this.singleValue = singleValue;
87     }
88
89     public boolean isCollective()
90     {
91         return collective;
92     }
93
94     public void setCollective( boolean collective )
95     {
96         this.collective = collective;
97     }
98
99     public boolean isNoUserModification()
100     {
101         return noUserModification;
102     }
103
104     public void setNoUserModification( boolean noUserModification )
105     {
106         this.noUserModification = noUserModification;
107     }
108
109     public String JavaDoc getOid()
110     {
111         return oid;
112     }
113
114     public String JavaDoc getDescription()
115     {
116         return description;
117     }
118
119     public void setDescription( String JavaDoc description )
120     {
121         this.description = description;
122     }
123
124     public String JavaDoc getSuperior()
125     {
126         return superior;
127     }
128
129     public void setSuperior( String JavaDoc superior )
130     {
131         this.superior = superior;
132     }
133
134     public String JavaDoc getEquality()
135     {
136         return equality;
137     }
138
139     public void setEquality( String JavaDoc equality )
140     {
141         this.equality = equality;
142     }
143
144     public String JavaDoc getOrdering()
145     {
146         return ordering;
147     }
148
149     public void setOrdering( String JavaDoc ordering )
150     {
151         this.ordering = ordering;
152     }
153
154     public String JavaDoc getSubstr()
155     {
156         return substr;
157     }
158
159     public void setSubstr( String JavaDoc substr )
160     {
161         this.substr = substr;
162     }
163
164     public String JavaDoc getSyntax()
165     {
166         return syntax;
167     }
168
169     public void setSyntax( String JavaDoc syntax )
170     {
171         this.syntax = syntax;
172     }
173
174     public UsageEnum getUsage()
175     {
176         return usage;
177     }
178
179     public void setUsage( UsageEnum usage )
180     {
181         this.usage = usage;
182     }
183
184     public String JavaDoc[] getNames()
185     {
186         return names;
187     }
188
189     public void setNames( String JavaDoc[] names )
190     {
191         this.names = names;
192     }
193
194     public int getLength()
195     {
196         return length;
197     }
198
199     public void setLength( int length )
200     {
201         this.length = length;
202     }
203
204
205     // ------------------------------------------------------------------------
206
// Object overrides
207
// ------------------------------------------------------------------------
208

209
210     public int hashCode()
211     {
212         return getOid().hashCode();
213     }
214
215
216     public boolean equals( Object JavaDoc obj )
217     {
218         if ( this == obj )
219         {
220             return true;
221         }
222
223         if ( ! ( obj instanceof AttributeTypeLiteral ) )
224         {
225             return false;
226         }
227
228         return getOid().equals( ( ( AttributeTypeLiteral ) obj ).getOid() );
229     }
230
231
232     public String JavaDoc toString()
233     {
234         return getOid();
235     }
236 }
237
Popular Tags