Class ObjectClassDefinition

    • Constructor Summary

      Constructors 
      Constructor Description
      ObjectClassDefinition​(java.lang.String s)
      Creates a new object class from the provided string representation.
      ObjectClassDefinition​(java.lang.String oid, java.lang.String[] names, java.lang.String description, boolean isObsolete, java.lang.String[] superiorClasses, ObjectClassType objectClassType, java.lang.String[] requiredAttributes, java.lang.String[] optionalAttributes, java.util.Map<java.lang.String,​java.lang.String[]> extensions)
      Creates a new object class with the provided information.
      ObjectClassDefinition​(java.lang.String oid, java.lang.String name, java.lang.String description, java.lang.String superiorClass, ObjectClassType objectClassType, java.lang.String[] requiredAttributes, java.lang.String[] optionalAttributes, java.util.Map<java.lang.String,​java.lang.String[]> extensions)
      Creates a new object class with the provided information.
      ObjectClassDefinition​(java.lang.String oid, java.lang.String name, java.lang.String description, java.lang.String superiorClass, ObjectClassType objectClassType, java.util.Collection<java.lang.String> requiredAttributes, java.util.Collection<java.lang.String> optionalAttributes, java.util.Map<java.lang.String,​java.lang.String[]> extensions)
      Creates a new object class with the provided information.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object o)
      Indicates whether the provided object is equal to this schema element.
      java.lang.String getDescription()
      Retrieves the description for this object class, if available.
      java.util.Map<java.lang.String,​java.lang.String[]> getExtensions()
      Retrieves the set of extensions for this object class.
      java.lang.String getNameOrOID()
      Retrieves the primary name that can be used to reference this object class.
      java.lang.String[] getNames()
      Retrieves the set of names for this object class.
      ObjectClassType getObjectClassType()
      Retrieves the object class type for this object class.
      ObjectClassType getObjectClassType​(Schema schema)
      Retrieves the object class type for this object class, recursively examining superior classes if necessary to make the determination.
      java.lang.String getOID()
      Retrieves the OID for this object class.
      java.lang.String[] getOptionalAttributes()
      Retrieves the names or OIDs of the attributes that may optionally be present in entries containing this object class.
      java.util.Set<AttributeTypeDefinition> getOptionalAttributes​(Schema schema, boolean includeSuperiorClasses)
      Retrieves the attribute type definitions for the attributes that may optionally be present in entries containing this object class, optionally including the set of optional attribute types from superior classes.
      java.lang.String[] getRequiredAttributes()
      Retrieves the names or OIDs of the attributes that are required to be present in entries containing this object class.
      java.util.Set<AttributeTypeDefinition> getRequiredAttributes​(Schema schema, boolean includeSuperiorClasses)
      Retrieves the attribute type definitions for the attributes that are required to be present in entries containing this object class, optionally including the set of required attribute types from superior classes.
      SchemaElementType getSchemaElementType()
      Retrieves the type of schema element that this object represents.
      java.lang.String[] getSuperiorClasses()
      Retrieves the names or OIDs of the superior classes for this object class, if available.
      java.util.Set<ObjectClassDefinition> getSuperiorClasses​(Schema schema, boolean recursive)
      Retrieves the object class definitions for the superior object classes.
      int hashCode()
      Retrieves a hash code for this schema element.
      boolean hasNameOrOID​(java.lang.String s)
      Indicates whether the provided string matches the OID or any of the names for this object class.
      boolean isObsolete()
      Indicates whether this object class is declared obsolete.
      java.lang.String toString()
      Retrieves a string representation of this object class definition, in the format described in RFC 4512 section 4.1.1.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • ObjectClassDefinition

        public ObjectClassDefinition​(@NotNull
                                     java.lang.String s)
                              throws LDAPException
        Creates a new object class from the provided string representation.
        Parameters:
        s - The string representation of the object class to create, using the syntax described in RFC 4512 section 4.1.1. It must not be null.
        Throws:
        LDAPException - If the provided string cannot be decoded as an object class definition.
      • ObjectClassDefinition

        public ObjectClassDefinition​(@NotNull
                                     java.lang.String oid,
                                     @Nullable
                                     java.lang.String name,
                                     @Nullable
                                     java.lang.String description,
                                     @Nullable
                                     java.lang.String superiorClass,
                                     @Nullable
                                     ObjectClassType objectClassType,
                                     @Nullable
                                     java.lang.String[] requiredAttributes,
                                     @Nullable
                                     java.lang.String[] optionalAttributes,
                                     @Nullable
                                     java.util.Map<java.lang.String,​java.lang.String[]> extensions)
        Creates a new object class with the provided information.
        Parameters:
        oid - The OID for this object class. It must not be null.
        name - The name for this object class. It may be null if the object class should only be referenced by OID.
        description - The description for this object class. It may be null if there is no description.
        superiorClass - The name/OID of the superior class for this object class. It may be null or empty if there is no superior class.
        objectClassType - The object class type for this object class.
        requiredAttributes - The names/OIDs of the attributes which must be present in entries containing this object class.
        optionalAttributes - The names/OIDs of the attributes which may be present in entries containing this object class.
        extensions - The set of extensions for this object class. It may be null or empty if there should not be any extensions.
      • ObjectClassDefinition

        public ObjectClassDefinition​(@NotNull
                                     java.lang.String oid,
                                     @Nullable
                                     java.lang.String name,
                                     @Nullable
                                     java.lang.String description,
                                     @Nullable
                                     java.lang.String superiorClass,
                                     @Nullable
                                     ObjectClassType objectClassType,
                                     @Nullable
                                     java.util.Collection<java.lang.String> requiredAttributes,
                                     @Nullable
                                     java.util.Collection<java.lang.String> optionalAttributes,
                                     @Nullable
                                     java.util.Map<java.lang.String,​java.lang.String[]> extensions)
        Creates a new object class with the provided information.
        Parameters:
        oid - The OID for this object class. It must not be null.
        name - The name for this object class. It may be null if the object class should only be referenced by OID.
        description - The description for this object class. It may be null if there is no description.
        superiorClass - The name/OID of the superior class for this object class. It may be null or empty if there is no superior class.
        objectClassType - The object class type for this object class.
        requiredAttributes - The names/OIDs of the attributes which must be present in entries containing this object class.
        optionalAttributes - The names/OIDs of the attributes which may be present in entries containing this object class.
        extensions - The set of extensions for this object class. It may be null or empty if there should not be any extensions.
      • ObjectClassDefinition

        public ObjectClassDefinition​(@NotNull
                                     java.lang.String oid,
                                     @Nullable
                                     java.lang.String[] names,
                                     @Nullable
                                     java.lang.String description,
                                     boolean isObsolete,
                                     @Nullable
                                     java.lang.String[] superiorClasses,
                                     @Nullable
                                     ObjectClassType objectClassType,
                                     @Nullable
                                     java.lang.String[] requiredAttributes,
                                     @Nullable
                                     java.lang.String[] optionalAttributes,
                                     @Nullable
                                     java.util.Map<java.lang.String,​java.lang.String[]> extensions)
        Creates a new object class with the provided information.
        Parameters:
        oid - The OID for this object class. It must not be null.
        names - The set of names for this object class. It may be null or empty if the object class should only be referenced by OID.
        description - The description for this object class. It may be null if there is no description.
        isObsolete - Indicates whether this object class is declared obsolete.
        superiorClasses - The names/OIDs of the superior classes for this object class. It may be null or empty if there is no superior class.
        objectClassType - The object class type for this object class.
        requiredAttributes - The names/OIDs of the attributes which must be present in entries containing this object class.
        optionalAttributes - The names/OIDs of the attributes which may be present in entries containing this object class.
        extensions - The set of extensions for this object class. It may be null or empty if there should not be any extensions.
    • Method Detail

      • getOID

        @NotNull
        public java.lang.String getOID()
        Retrieves the OID for this object class.
        Returns:
        The OID for this object class.
      • getNames

        @NotNull
        public java.lang.String[] getNames()
        Retrieves the set of names for this object class.
        Returns:
        The set of names for this object class, or an empty array if it does not have any names.
      • getNameOrOID

        @NotNull
        public java.lang.String getNameOrOID()
        Retrieves the primary name that can be used to reference this object class. If one or more names are defined, then the first name will be used. Otherwise, the OID will be returned.
        Returns:
        The primary name that can be used to reference this object class.
      • hasNameOrOID

        public boolean hasNameOrOID​(@NotNull
                                    java.lang.String s)
        Indicates whether the provided string matches the OID or any of the names for this object class.
        Parameters:
        s - The string for which to make the determination. It must not be null.
        Returns:
        true if the provided string matches the OID or any of the names for this object class, or false if not.
      • getDescription

        @Nullable
        public java.lang.String getDescription()
        Retrieves the description for this object class, if available.
        Returns:
        The description for this object class, or null if there is no description defined.
      • isObsolete

        public boolean isObsolete()
        Indicates whether this object class is declared obsolete.
        Returns:
        true if this object class is declared obsolete, or false if it is not.
      • getSuperiorClasses

        @NotNull
        public java.lang.String[] getSuperiorClasses()
        Retrieves the names or OIDs of the superior classes for this object class, if available.
        Returns:
        The names or OIDs of the superior classes for this object class, or an empty array if it does not have any superior classes.
      • getSuperiorClasses

        @NotNull
        public java.util.Set<ObjectClassDefinitiongetSuperiorClasses​(@NotNull
                                                                       Schema schema,
                                                                       boolean recursive)
        Retrieves the object class definitions for the superior object classes.
        Parameters:
        schema - The schema to use to retrieve the object class definitions.
        recursive - Indicates whether to recursively include all of the superior object class definitions from superior classes.
        Returns:
        The object class definitions for the superior object classes.
      • getObjectClassType

        @Nullable
        public ObjectClassType getObjectClassType()
        Retrieves the object class type for this object class. This method will return null if this object class definition does not explicitly specify the object class type, although in that case, the object class type should be assumed to be ObjectClassType.STRUCTURAL as per RFC 4512 section 4.1.1.
        Returns:
        The object class type for this object class, or null if it is not defined in the schema element.
      • getObjectClassType

        @NotNull
        public ObjectClassType getObjectClassType​(@NotNull
                                                  Schema schema)
        Retrieves the object class type for this object class, recursively examining superior classes if necessary to make the determination.

        Note that versions of this method before the 4.0.6 release of the LDAP SDK operated under the incorrect assumption that if an object class definition did not explicitly specify the object class type, it would be inherited from its superclass. The correct behavior, as per RFC 4512 section 4.1.1, is that if the object class type is not explicitly specified, it should be assumed to be ObjectClassType.STRUCTURAL.
        Parameters:
        schema - The schema to use to retrieve the definitions for the superior object classes. As of LDAP SDK version 4.0.6, this argument is no longer used (and may be null if desired), but this version of the method has been preserved both for the purpose of retaining API compatibility with previous versions of the LDAP SDK, and to disambiguate it from the zero-argument version of the method that returns null if the object class type is not explicitly specified.
        Returns:
        The object class type for this object class, or ObjectClassType.STRUCTURAL if it is not explicitly defined.
      • getRequiredAttributes

        @NotNull
        public java.lang.String[] getRequiredAttributes()
        Retrieves the names or OIDs of the attributes that are required to be present in entries containing this object class. Note that this will not automatically include the set of required attributes from any superior classes.
        Returns:
        The names or OIDs of the attributes that are required to be present in entries containing this object class, or an empty array if there are no required attributes.
      • getRequiredAttributes

        @NotNull
        public java.util.Set<AttributeTypeDefinitiongetRequiredAttributes​(@NotNull
                                                                            Schema schema,
                                                                            boolean includeSuperiorClasses)
        Retrieves the attribute type definitions for the attributes that are required to be present in entries containing this object class, optionally including the set of required attribute types from superior classes.
        Parameters:
        schema - The schema to use to retrieve the attribute type definitions.
        includeSuperiorClasses - Indicates whether to include definitions for required attribute types in superior object classes.
        Returns:
        The attribute type definitions for the attributes that are required to be present in entries containing this object class.
      • getOptionalAttributes

        @NotNull
        public java.lang.String[] getOptionalAttributes()
        Retrieves the names or OIDs of the attributes that may optionally be present in entries containing this object class. Note that this will not automatically include the set of optional attributes from any superior classes.
        Returns:
        The names or OIDs of the attributes that may optionally be present in entries containing this object class, or an empty array if there are no optional attributes.
      • getOptionalAttributes

        @NotNull
        public java.util.Set<AttributeTypeDefinitiongetOptionalAttributes​(@NotNull
                                                                            Schema schema,
                                                                            boolean includeSuperiorClasses)
        Retrieves the attribute type definitions for the attributes that may optionally be present in entries containing this object class, optionally including the set of optional attribute types from superior classes.
        Parameters:
        schema - The schema to use to retrieve the attribute type definitions.
        includeSuperiorClasses - Indicates whether to include definitions for optional attribute types in superior object classes.
        Returns:
        The attribute type definitions for the attributes that may optionally be present in entries containing this object class.
      • getExtensions

        @NotNull
        public java.util.Map<java.lang.String,​java.lang.String[]> getExtensions()
        Retrieves the set of extensions for this object class. They will be mapped from the extension name (which should start with "X-") to the set of values for that extension.
        Returns:
        The set of extensions for this object class.
      • hashCode

        public int hashCode()
        Retrieves a hash code for this schema element.
        Specified by:
        hashCode in class SchemaElement
        Returns:
        A hash code for this schema element.
      • equals

        public boolean equals​(@Nullable
                              java.lang.Object o)
        Indicates whether the provided object is equal to this schema element.
        Specified by:
        equals in class SchemaElement
        Parameters:
        o - The object for which to make the determination.
        Returns:
        true if the provided object may be considered equal to this schema element, or false if not.
      • toString

        @NotNull
        public java.lang.String toString()
        Retrieves a string representation of this object class definition, in the format described in RFC 4512 section 4.1.1.
        Specified by:
        toString in class SchemaElement
        Returns:
        A string representation of this object class definition.