001    /*
002     *  Licensed to the Apache Software Foundation (ASF) under one
003     *  or more contributor license agreements.  See the NOTICE file
004     *  distributed with this work for additional information
005     *  regarding copyright ownership.  The ASF licenses this file
006     *  to you under the Apache License, Version 2.0 (the
007     *  "License"); you may not use this file except in compliance
008     *  with the License.  You may obtain a copy of the License at
009     *  
010     *    http://www.apache.org/licenses/LICENSE-2.0
011     *  
012     *  Unless required by applicable law or agreed to in writing,
013     *  software distributed under the License is distributed on an
014     *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015     *  KIND, either express or implied.  See the License for the
016     *  specific language governing permissions and limitations
017     *  under the License. 
018     *  
019     */
020    package org.apache.directory.shared.ldap.schema.parsers;
021    
022    
023    import org.apache.directory.shared.ldap.schema.ObjectClassTypeEnum;
024    import org.apache.directory.shared.ldap.util.ArrayUtils;
025    
026    
027    /**
028     * A bean used to encapsulate the literal String values of an ObjectClass
029     * definition found within an OpenLDAP schema configuration file.
030     *
031     * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
032     * @version $Rev: 437016 $
033     */
034    public class ObjectClassLiteral
035    {
036        private boolean obsolete = false;
037    
038        private String oid;
039        private String description;
040    
041        private String[] names = ArrayUtils.EMPTY_STRING_ARRAY;
042        private String[] superiors = ArrayUtils.EMPTY_STRING_ARRAY;
043        private String[] must = ArrayUtils.EMPTY_STRING_ARRAY;
044        private String[] may = ArrayUtils.EMPTY_STRING_ARRAY;
045    
046        private ObjectClassTypeEnum classType = ObjectClassTypeEnum.STRUCTURAL;
047    
048    
049        // ------------------------------------------------------------------------
050        // C O N S T R U C T O R S
051        // ------------------------------------------------------------------------
052    
053        public ObjectClassLiteral(String oid)
054        {
055            this.oid = oid;
056        }
057    
058    
059        // ------------------------------------------------------------------------
060        // Accessors and mutators
061        // ------------------------------------------------------------------------
062    
063        public boolean isObsolete()
064        {
065            return obsolete;
066        }
067    
068    
069        public void setObsolete( boolean obsolete )
070        {
071            this.obsolete = obsolete;
072        }
073    
074    
075        public String getOid()
076        {
077            return oid;
078        }
079    
080    
081        public void setOid( String oid )
082        {
083            this.oid = oid;
084        }
085    
086    
087        public String getDescription()
088        {
089            return description;
090        }
091    
092    
093        public void setDescription( String description )
094        {
095            this.description = description;
096        }
097    
098    
099        public String[] getNames()
100        {
101            return names;
102        }
103    
104    
105        public void setNames( String[] names )
106        {
107            this.names = names;
108        }
109    
110    
111        public String[] getSuperiors()
112        {
113            return superiors;
114        }
115    
116    
117        public void setSuperiors( String[] superiors )
118        {
119            this.superiors = superiors;
120        }
121    
122    
123        public String[] getMust()
124        {
125            return must;
126        }
127    
128    
129        public void setMust( String[] must )
130        {
131            this.must = must;
132        }
133    
134    
135        public String[] getMay()
136        {
137            return may;
138        }
139    
140    
141        public void setMay( String[] may )
142        {
143            this.may = may;
144        }
145    
146    
147        public ObjectClassTypeEnum getClassType()
148        {
149            return classType;
150        }
151    
152    
153        public void setClassType( ObjectClassTypeEnum classType )
154        {
155            this.classType = classType;
156        }
157    
158    
159        // ------------------------------------------------------------------------
160        // Object overrides
161        // ------------------------------------------------------------------------
162    
163        /**
164         * Compute the instance's hash code
165         * @return the instance's hash code 
166         */
167        public int hashCode()
168        {
169            return getOid().hashCode();
170        }
171    
172    
173        public boolean equals( Object obj )
174        {
175            if ( this == obj )
176            {
177                return true;
178            }
179    
180            if ( !( obj instanceof ObjectClassLiteral ) )
181            {
182                return false;
183            }
184    
185            return getOid().equals( ( ( ObjectClassLiteral ) obj ).getOid() );
186        }
187    
188    
189        public String toString()
190        {
191            return getOid();
192        }
193    }