View Javadoc
1   /*
2    *  Licensed to the Apache Software Foundation (ASF) under one
3    *  or more contributor license agreements.  See the NOTICE file
4    *  distributed with this work for additional information
5    *  regarding copyright ownership.  The ASF licenses this file
6    *  to you under the Apache License, Version 2.0 (the
7    *  "License"); you may not use this file except in compliance
8    *  with the License.  You may obtain a copy of the License at
9    *  
10   *    https://www.apache.org/licenses/LICENSE-2.0
11   *  
12   *  Unless required by applicable law or agreed to in writing,
13   *  software distributed under the License is distributed on an
14   *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   *  KIND, either express or implied.  See the License for the
16   *  specific language governing permissions and limitations
17   *  under the License. 
18   *  
19   */
20  package org.apache.directory.api.ldap.model.schema;
21  
22  
23  import org.apache.directory.api.util.Strings;
24  
25  
26  /**
27   * Type safe enumerations for an objectClass' type. An ObjectClass type can be
28   * one of the following types:
29   * <ul>
30   * <li>ABSTRACT</li>
31   * <li>AUXILIARY</li>
32   * <li>STRUCTURAL</li>
33   * </ul>
34   * 
35   * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
36   */
37  public enum ObjectClassTypeEnum
38  {
39      /** The enumeration constant value for the abstract objectClasses */
40      ABSTRACT(0),
41  
42      /** The enumeration constant value for the auxillary objectClasses */
43      AUXILIARY(1),
44  
45      /** The enumeration constant value for the structural objectClasses */
46      STRUCTURAL(2);
47  
48      /** The int constant value for the abstract objectClasses */
49      public static final int ABSTRACT_VAL = 0;
50  
51      /** The int constant value for the auxillary objectClasses */
52      public static final int AUXILIARY_VAL = 1;
53  
54      /** The int constant value for the structural objectClasses */
55      public static final int STRUCTURAL_VAL = 2;
56  
57      /** Stores the integer value of each element of the enumeration */
58      private int value;
59  
60  
61      /**
62       * Private constructor so no other instances can be created other than the
63       * public static constants in this class.
64       * 
65       * @param value the integer value of the enumeration.
66       */
67      ObjectClassTypeEnum( int value )
68      {
69          this.value = value;
70      }
71  
72  
73      /**
74       * @return The value associated with the current element.
75       */
76      public int getValue()
77      {
78          return value;
79      }
80  
81  
82      /**
83       * Gets the objectClass type enumeration of AUXILIARY, STRUCTURAL, or,
84       * ABSTRACT.
85       * 
86       * @param name options are AUXILIARY, STRUCTURAL, or, ABSTRACT
87       * 
88       * @return the type safe enumeration for the objectClass type
89       */
90      public static ObjectClassTypeEnum getClassType( String name )
91      {
92          return valueOf( Strings.upperCase( name.trim() ) );
93      }
94  }