001/* 002 * CDDL HEADER START 003 * 004 * The contents of this file are subject to the terms of the 005 * Common Development and Distribution License, Version 1.0 only 006 * (the "License"). You may not use this file except in compliance 007 * with the License. 008 * 009 * You can obtain a copy of the license at 010 * docs/licenses/cddl.txt 011 * or http://www.opensource.org/licenses/cddl1.php. 012 * See the License for the specific language governing permissions 013 * and limitations under the License. 014 * 015 * When distributing Covered Code, include this CDDL HEADER in each 016 * file and include the License file at 017 * docs/licenses/cddl.txt. If applicable, 018 * add the following below this CDDL HEADER, with the fields enclosed 019 * by brackets "[]" replaced with your own identifying information: 020 * Portions Copyright [yyyy] [name of copyright owner] 021 * 022 * CDDL HEADER END 023 * 024 * 025 * Copyright 2010-2020 Ping Identity Corporation 026 */ 027package com.unboundid.directory.sdk.common.schema; 028 029 030 031import java.util.List; 032import java.util.Map; 033import java.util.Set; 034 035import com.unboundid.ldap.sdk.schema.ObjectClassType; 036import com.unboundid.util.NotExtensible; 037import com.unboundid.util.ThreadSafety; 038import com.unboundid.util.ThreadSafetyLevel; 039 040 041 042/** 043 * This interface defines a set of methods that may be used to obtain 044 * information about an object class defined in the server schema. 045 */ 046@NotExtensible() 047@ThreadSafety(level=ThreadSafetyLevel.INTERFACE_THREADSAFE) 048public interface ObjectClass 049{ 050 /** 051 * Retrieves the numeric OID for this object class. 052 * 053 * @return The numeric OID for this object class. 054 */ 055 String getOID(); 056 057 058 059 /** 060 * Retrieves the list of names for this object class, if any. 061 * 062 * @return The list of names for this object class, or an empty list if 063 * there are no user-defined names. 064 */ 065 List<String> getNames(); 066 067 068 069 /** 070 * Retrieves the primary name for this object class, or the numeric OID if 071 * no names are defined. 072 * 073 * @return The primary name or OID for this object class. 074 */ 075 String getNameOrOID(); 076 077 078 079 /** 080 * Indicates whether the provided string is equal to the OID or any of the 081 * defined names for this object class. 082 * 083 * @param name The name for which to make the determination. 084 * 085 * @return {@code true} if the provided string matches the OID or one of the 086 * names for this object class, or {@code false} if not. 087 */ 088 boolean hasNameOrOID(final String name); 089 090 091 092 /** 093 * Retrieves the description for this object class, if any. 094 * 095 * @return The description for this object class, or {@code null} if it does 096 * not have a description. 097 */ 098 String getDescription(); 099 100 101 102 /** 103 * Retrieves the immediate superior classes for this object class, if any. 104 * 105 * @return The immediate superior classes for this object class, or an empty 106 * list if this object class does not have any superior classes. 107 */ 108 List<ObjectClass> getSuperiorClasses(); 109 110 111 112 /** 113 * Retrieves the set of required attributes for this object class. This set 114 * will only include the required attributes defined for this object class 115 * itself and not those of its superior classes. 116 * 117 * @return The set of required attributes for this object class, or an empty 118 * list if it does not have any required attributes. 119 */ 120 Set<AttributeType> getRequiredAttributes(); 121 122 123 124 /** 125 * Retrieves the set of required attributes for this object class and all of 126 * its superior classes. 127 * 128 * @return The set of required attributes for this object class and all of 129 * its superior classes, or an empty list if it does not have any 130 * required attributes. 131 */ 132 Set<AttributeType> getRequiredAttributeChain(); 133 134 135 136 /** 137 * Indicates whether the provided attribute type is required for use with this 138 * object class or any of its superior classes. 139 * 140 * @param t The attribute type for which to make the definition. 141 * 142 * @return {@code true} if the provided attribute type is required for use 143 * with this object class, or {@code false} if not. 144 */ 145 boolean isRequired(final AttributeType t); 146 147 148 149 /** 150 * Retrieves the set of optional attributes for this object class. This set 151 * will only include the optional attributes defined for this object class 152 * itself and not those of its superior classes. 153 * 154 * @return The set of optional attributes for this object class, or an empty 155 * list if it does not have any optional attributes. 156 */ 157 Set<AttributeType> getOptionalAttributes(); 158 159 160 161 /** 162 * Retrieves the set of optional attributes for this object class and all of 163 * its superior classes. 164 * 165 * @return The set of optional attributes for this object class and all of 166 * its superior classes, or an empty list if it does not have any 167 * optional attributes. 168 */ 169 Set<AttributeType> getOptionalAttributeChain(); 170 171 172 173 /** 174 * Indicates whether the provided attribute type is optional for use with this 175 * object class or any of its superior classes. 176 * 177 * @param t The attribute type for which to make the definition. 178 * 179 * @return {@code true} if the provided attribute type is optional for use 180 * with this object class, or {@code false} if not. 181 */ 182 boolean isOptional(final AttributeType t); 183 184 185 186 /** 187 * Indicates whether the provided attribute type is allowed for use with this 188 * object class or any of its superior classes, either as a required or 189 * optional type. 190 * 191 * @param t The attribute type for which to make the definition. 192 * 193 * @return {@code true} if the provided attribute type is allowed for use 194 * with this object class, or {@code false} if not. 195 */ 196 boolean isRequiredOrOptional(final AttributeType t); 197 198 199 200 /** 201 * Retrieves the object class type for this object class. 202 * 203 * @return The object class type for this object class. 204 */ 205 ObjectClassType getObjectClassType(); 206 207 208 209 /** 210 * Indicates whether this object class is declared obsolete in the server 211 * schema. 212 * 213 * @return {@code true} if this object class is declared obsolete in the 214 * server schema, or {@code false} if not. 215 */ 216 boolean isObsolete(); 217 218 219 220 /** 221 * Retrieves a map of all defined extensions for this object class. 222 * 223 * @return A map of all defined extensions for this object class. 224 */ 225 Map<String,List<String>> getExtensions(); 226 227 228 229 /** 230 * Retrieves the name of the schema file in which this object class is 231 * defined. 232 * 233 * @return The name of the schema file in which this object class is defined. 234 */ 235 String getSchemaFileName(); 236 237 238 239 /** 240 * Indicates whether the provided object is equal to this object class. 241 * 242 * @param o The object for which to make the determination. 243 * 244 * @return {@code true} if the provided object is equal to this object class, 245 * or {@code false} if not. 246 */ 247 boolean equals(final Object o); 248 249 250 251 /** 252 * Retrieves a hash code for this object class. 253 * 254 * @return A hash code for this object class. 255 */ 256 int hashCode(); 257 258 259 260 /** 261 * Retrieves a string representation of this object class definition. 262 * 263 * @return A string representation of this object class definition. 264 */ 265 String toString(); 266}