001/* 002 * Copyright 2007-2017 UnboundID Corp. 003 * All Rights Reserved. 004 */ 005/* 006 * Copyright (C) 2008-2017 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 */ 021package com.unboundid.ldap.sdk.schema; 022 023 024 025import com.unboundid.util.ThreadSafety; 026import com.unboundid.util.ThreadSafetyLevel; 027 028 029 030/** 031 * This enum defines the set of object class types that are defined in the LDAP 032 * protocol. 033 */ 034@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE) 035public enum ObjectClassType 036{ 037 /** 038 * The object class type for abstract object classes. An abstract object 039 * class may only serve as the superclass for another object class, and may 040 * not appear in an entry unless at least one of its non-abstract subclasses 041 * is also included. 042 */ 043 ABSTRACT("ABSTRACT"), 044 045 046 047 /** 048 * The object class type for structural object classes. An entry must have 049 * exactly one structural object class. 050 */ 051 STRUCTURAL("STRUCTURAL"), 052 053 054 055 /** 056 * The object class type for auxiliary object classes. An entry may have any 057 * number of auxiliary classes (although that may potentially be restricted by 058 * DIT content rule definitions in the server). 059 */ 060 AUXILIARY("AUXILIARY"); 061 062 063 064 // The name for this object class type. 065 private final String name; 066 067 068 069 /** 070 * Creates a new object class type with the specified name. 071 * 072 * @param name The name for this object class type. 073 */ 074 private ObjectClassType(final String name) 075 { 076 this.name = name; 077 } 078 079 080 081 /** 082 * Retrieves the name of this object class type. 083 * 084 * @return The name of this object class type. 085 */ 086 public String getName() 087 { 088 return name; 089 } 090 091 092 093 /** 094 * Retrieves the object class type value with the specified name. 095 * 096 * @param name The name of the object class type to retrieve. 097 * 098 * @return The object class type with the specified name, or {@code null} if 099 * there is no type with the given name. 100 */ 101 public static ObjectClassType forName(final String name) 102 { 103 for (final ObjectClassType t : values()) 104 { 105 if (t.name.equalsIgnoreCase(name)) 106 { 107 return t; 108 } 109 } 110 111 return null; 112 } 113 114 115 116 /** 117 * Retrieves a string representation of this object class type. 118 * 119 * @return A string representation of this object class type. 120 */ 121 @Override() 122 public String toString() 123 { 124 return name; 125 } 126}