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 java.util.ArrayList;
024    import java.util.LinkedHashMap;
025    import java.util.List;
026    import java.util.Map;
027    
028    
029    public class AbstractSchemaDescription
030    {
031            /** The schema element numeric OID */
032        protected String numericOid;
033        
034        /** The schema element list of short names */
035        protected List<String> names;
036        
037        /** A description for this schema element */
038        protected String description;
039        
040        /** Tells if this schema element is obsolte */
041        protected boolean isObsolete;
042        
043        /** A map containing the list of supported extensions */
044        protected Map<String, List<String>> extensions;
045    
046    
047        protected AbstractSchemaDescription()
048        {
049            numericOid = null;
050            names = new ArrayList<String>();
051            description = null;
052            isObsolete = false;
053            extensions = new LinkedHashMap<String, List<String>>();
054        }
055    
056    
057        public String getDescription()
058        {
059            return description;
060        }
061    
062    
063        public void setDescription( String description )
064        {
065            this.description = description;
066        }
067    
068    
069        public Map<String, List<String>> getExtensions()
070        {
071            return extensions;
072        }
073    
074    
075        public void setExtensions( Map<String, List<String>> extensions )
076        {
077            this.extensions = extensions;
078        }
079    
080    
081        public boolean isObsolete()
082        {
083            return isObsolete;
084        }
085    
086    
087        public void setObsolete( boolean isObsolete )
088        {
089            this.isObsolete = isObsolete;
090        }
091    
092    
093        public List<String> getNames()
094        {
095            return names;
096        }
097    
098    
099        public void setNames( List<String> names )
100        {
101            this.names = names;
102        }
103    
104    
105        public String getNumericOid()
106        {
107            return numericOid;
108        }
109    
110    
111        public void setNumericOid( String oid )
112        {
113            this.numericOid = oid;
114        }
115    
116    
117        public void addExtension( String key, List<String> values )
118        {
119            extensions.put( key, values );
120        }
121    
122    
123        /**
124         * Compute the instance's hash code
125         * @return the instance's hash code 
126         */
127        public int hashCode()
128        {
129            return numericOid.hashCode();
130        }
131    
132    
133        public boolean equals( Object obj )
134        {
135            if ( ! ( obj instanceof AbstractSchemaDescription ) )
136            {
137                return false;
138            }
139    
140            return ( ( AbstractSchemaDescription ) obj ).numericOid.equals( numericOid );
141        }
142    }