001 /* 002 * Copyright 2007-2016 UnboundID Corp. 003 * All Rights Reserved. 004 */ 005 /* 006 * Copyright (C) 2008-2016 UnboundID Corp. 007 * 008 * This program is free software; you can redistribute it and/or modify 009 * it under the terms of the GNU General Public License (GPLv2 only) 010 * or the terms of the GNU Lesser General Public License (LGPLv2.1 only) 011 * as published by the Free Software Foundation. 012 * 013 * This program is distributed in the hope that it will be useful, 014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 016 * GNU General Public License for more details. 017 * 018 * You should have received a copy of the GNU General Public License 019 * along with this program; if not, see <http://www.gnu.org/licenses>. 020 */ 021 package com.unboundid.ldap.sdk.schema; 022 023 024 025 026 027 028 /** 029 * This enum defines the set of object class types that are defined in the LDAP 030 * protocol. 031 */ 032 public enum ObjectClassType 033 { 034 /** 035 * The object class type for abstract object classes. An abstract object 036 * class may only serve as the superclass for another object class, and may 037 * not appear in an entry unless at least one of its non-abstract subclasses 038 * is also included. 039 */ 040 ABSTRACT("ABSTRACT"), 041 042 043 044 /** 045 * The object class type for structural object classes. An entry must have 046 * exactly one structural object class. 047 */ 048 STRUCTURAL("STRUCTURAL"), 049 050 051 052 /** 053 * The object class type for auxiliary object classes. An entry may have any 054 * number of auxiliary classes (although that may potentially be restricted by 055 * DIT content rule definitions in the server). 056 */ 057 AUXILIARY("AUXILIARY"); 058 059 060 061 // The name for this object class type. 062 private final String name; 063 064 065 066 /** 067 * Creates a new object class type with the specified name. 068 * 069 * @param name The name for this object class type. 070 */ 071 private ObjectClassType(final String name) 072 { 073 this.name = name; 074 } 075 076 077 078 /** 079 * Retrieves the name of this object class type. 080 * 081 * @return The name of this object class type. 082 */ 083 public String getName() 084 { 085 return name; 086 } 087 088 089 090 /** 091 * Retrieves the object class type value with the specified name. 092 * 093 * @param name The name of the object class type to retrieve. 094 * 095 * @return The object class type with the specified name, or {@code null} if 096 * there is no type with the given name. 097 */ 098 public static ObjectClassType forName(final String name) 099 { 100 for (final ObjectClassType t : values()) 101 { 102 if (t.name.equalsIgnoreCase(name)) 103 { 104 return t; 105 } 106 } 107 108 return null; 109 } 110 111 112 113 /** 114 * Retrieves a string representation of this object class type. 115 * 116 * @return A string representation of this object class type. 117 */ 118 @Override() 119 public String toString() 120 { 121 return name; 122 } 123 }