Class AttributeType

java.lang.Object
org.forgerock.opendj.ldap.schema.AttributeType
All Implemented Interfaces:
Comparable<AttributeType>, SchemaElement

public final class AttributeType extends Object implements Comparable<AttributeType>
This class defines a data structure for storing and interacting with an attribute type, which contains information about the format of an attribute and the syntax and matching rules that should be used when interacting with it.

Where ordered sets of names, or extra properties are provided, the ordering will be preserved when the associated fields are accessed via their getters or via the Object.toString() methods.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final class 
    A fluent API for incrementally constructing attribute type.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Compares this attribute type to the provided attribute type.
    boolean
    Returns true if the provided object is an attribute type having the same numeric OID as this attribute type.
    Returns the matching rule that should be used for approximate matching with this attribute type.
    final String
    Returns the description of this schema element, or the empty string if it does not have a description.
    Returns the matching rule that should be used for equality matching with this attribute type.
    Returns an unmodifiable map containing all of the extra properties associated with this schema element.
    Returns the name or OID for this schema definition.
    Returns an unmodifiable list containing the user-defined names that may be used to reference this schema definition.
    Returns the OID for this schema definition.
    Returns the matching rule that should be used for ordering with this attribute type.
    Returns the matching rule that should be used for substring matching with this attribute type.
    Returns the sub-types inheriting directly or indirectly from this attribute type.
    Returns the superior type for this attribute type.
    Returns the syntax for this attribute type.
    Returns the usage indicator for this attribute type.
    int
    Returns the hash code for this attribute type.
    boolean
    Indicates whether this schema definition has the specified name.
    boolean
    Indicates whether this schema definition has the specified name or OID.
    boolean
    Returns whether this attribute type has sub-types, inheriting directly or indirectly from this attribute type.
    boolean
    Indicates whether this attribute type is declared "collective".
    boolean
    Indicates whether this attribute type is declared "no-user-modification".
    boolean
    Indicates whether this attribute type is the objectClass attribute type having the OID 2.5.4.0.
    boolean
    Indicates whether this schema definition is declared "obsolete".
    boolean
    Indicates whether this is an operational attribute.
    boolean
    Indicates whether this attribute type is a temporary place-holder allocated dynamically by a non-strict schema when no registered attribute type was found.
    boolean
    Indicates whether this attribute type is declared "single-value".
    boolean
    Indicates whether this attribute type is a sub-type of the provided attribute type.
    boolean
    Indicates whether this attribute type is a super-type of the provided attribute type.
    boolean
    Implements a place-holder tolerant version of equals(java.lang.Object).
    Returns the option-less attribute description corresponding to this attribute type.
    final String
    Returns the string representation of this schema element as defined in RFC 2252.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Method Details

    • compareTo

      public int compareTo(AttributeType type)
      Compares this attribute type to the provided attribute type. The sort-order is defined as follows:
      • The objectClass attribute is less than all other attribute types.
      • User attributes are less than operational attributes.
      • Lexicographic comparison of the primary name and then, if equal, the OID.
      Specified by:
      compareTo in interface Comparable<AttributeType>
      Parameters:
      type - The attribute type to be compared.
      Returns:
      A negative integer, zero, or a positive integer as this attribute type is less than, equal to, or greater than the specified attribute type.
      Throws:
      NullPointerException - If name was null.
    • equals

      public boolean equals(Object o)
      Returns true if the provided object is an attribute type having the same numeric OID as this attribute type.
      Parameters:
      o - The object to be compared.
      Returns:
      true if the provided object is an attribute type having the same numeric OID as this attribute type.
    • getApproximateMatchingRule

      public MatchingRule getApproximateMatchingRule()
      Returns the matching rule that should be used for approximate matching with this attribute type.
      Returns:
      The matching rule that should be used for approximate matching with this attribute type.
    • getSubTypes

      public Iterable<AttributeType> getSubTypes()
      Returns the sub-types inheriting directly or indirectly from this attribute type.
      Returns:
      the sub-types inheriting directly or indirectly from this attribute type
    • hasSubTypes

      public boolean hasSubTypes()
      Returns whether this attribute type has sub-types, inheriting directly or indirectly from this attribute type.
      Returns:
      true if this attribute type has sub-types, false otherwise
    • getEqualityMatchingRule

      public MatchingRule getEqualityMatchingRule()
      Returns the matching rule that should be used for equality matching with this attribute type.
      Returns:
      The matching rule that should be used for equality matching with this attribute type.
    • getNameOrOid

      public String getNameOrOid()
      Returns the name or OID for this schema definition. If it has one or more names, then the primary name will be returned. If it does not have any names, then the OID will be returned.
      Returns:
      The name or OID for this schema definition.
    • getNames

      public List<String> getNames()
      Returns an unmodifiable list containing the user-defined names that may be used to reference this schema definition.
      Returns:
      Returns an unmodifiable list containing the user-defined names that may be used to reference this schema definition.
    • getOid

      public String getOid()
      Returns the OID for this schema definition.
      Returns:
      The OID for this schema definition.
    • getOrderingMatchingRule

      public MatchingRule getOrderingMatchingRule()
      Returns the matching rule that should be used for ordering with this attribute type.
      Returns:
      The matching rule that should be used for ordering with this attribute type.
    • getSubstringMatchingRule

      public MatchingRule getSubstringMatchingRule()
      Returns the matching rule that should be used for substring matching with this attribute type.
      Returns:
      The matching rule that should be used for substring matching with this attribute type.
    • getSuperiorType

      public AttributeType getSuperiorType()
      Returns the superior type for this attribute type.
      Returns:
      The superior type for this attribute type, or null if it does not have one.
    • getSyntax

      public Syntax getSyntax()
      Returns the syntax for this attribute type.
      Returns:
      The syntax for this attribute type.
    • getUsage

      public AttributeUsage getUsage()
      Returns the usage indicator for this attribute type.
      Returns:
      The usage indicator for this attribute type.
    • hashCode

      public int hashCode()
      Returns the hash code for this attribute type. It will be calculated as the hash code of the numeric OID.
      Returns:
      The hash code for this attribute type.
    • hasName

      public boolean hasName(String name)
      Indicates whether this schema definition has the specified name.
      Parameters:
      name - The name for which to make the determination.
      Returns:
      true if the specified name is assigned to this schema definition, false otherwise.
    • hasNameOrOid

      public boolean hasNameOrOid(String value)
      Indicates whether this schema definition has the specified name or OID.
      Parameters:
      value - The value for which to make the determination.
      Returns:
      true if the provided value matches the OID or one of the names assigned to this schema definition, false otherwise.
    • isCollective

      public boolean isCollective()
      Indicates whether this attribute type is declared "collective".
      Returns:
      true if this attribute type is declared "collective", false otherwise.
    • isNoUserModification

      public boolean isNoUserModification()
      Indicates whether this attribute type is declared "no-user-modification".
      Returns:
      true if this attribute type is declared "no-user-modification", false otherwise.
    • isObjectClass

      public boolean isObjectClass()
      Indicates whether this attribute type is the objectClass attribute type having the OID 2.5.4.0.
      Returns:
      true if this attribute type is the objectClass attribute type, false otherwise.
    • isObsolete

      public boolean isObsolete()
      Indicates whether this schema definition is declared "obsolete".
      Returns:
      true if this schema definition is declared "obsolete", false otherwise.
    • isOperational

      public boolean isOperational()
      Indicates whether this is an operational attribute. An operational attribute is one with a usage of "directoryOperation", "distributedOperation", or "dSAOperation" (i.e., only userApplications is not operational).
      Returns:
      true if this is an operational attribute, false otherwise.
    • isPlaceHolder

      public boolean isPlaceHolder()
      Indicates whether this attribute type is a temporary place-holder allocated dynamically by a non-strict schema when no registered attribute type was found.

      Place holder attribute types have an OID which is the normalized attribute name with the string -oid appended. In addition, they will use the directory string syntax and case ignore matching rule.

      Returns:
      true if this is a temporary place-holder attribute type allocated dynamically by a non-strict schema when no registered attribute type was found.
      See Also:
    • isSingleValue

      public boolean isSingleValue()
      Indicates whether this attribute type is declared "single-value".
      Returns:
      true if this attribute type is declared "single-value", false otherwise.
    • isSubTypeOf

      public boolean isSubTypeOf(AttributeType type)
      Indicates whether this attribute type is a sub-type of the provided attribute type.
      Parameters:
      type - The attribute type for which to make the determination.
      Returns:
      true if this attribute type is a sub-type of the provided attribute type, false otherwise.
      Throws:
      NullPointerException - If type was null.
    • isSuperTypeOf

      public boolean isSuperTypeOf(AttributeType type)
      Indicates whether this attribute type is a super-type of the provided attribute type.
      Parameters:
      type - The attribute type for which to make the determination.
      Returns:
      true if this attribute type is a super-type of the provided attribute type, false otherwise.
      Throws:
      NullPointerException - If type was null.
    • matches

      public boolean matches(AttributeType type)
      Implements a place-holder tolerant version of equals(java.lang.Object). This method returns true in the following cases:
      • this attribute type is equal to the provided attribute type as specified by equals(java.lang.Object)
      • this attribute type is a place-holder and the provided attribute type has a name which matches the name of this attribute type
      • the provided attribute type is a place-holder and this attribute type has a name which matches the name of the provided attribute type.
      Parameters:
      type - The attribute type for which to make the determination.
      Returns:
      true if the provided attribute type matches this attribute type.
    • toAttributeDescription

      public AttributeDescription toAttributeDescription()
      Returns the option-less attribute description corresponding to this attribute type.
      Returns:
      the option-less attribute description corresponding to this attribute type
    • getDescription

      public final String getDescription()
      Description copied from interface: SchemaElement
      Returns the description of this schema element, or the empty string if it does not have a description.
      Specified by:
      getDescription in interface SchemaElement
      Returns:
      The description of this schema element, or the empty string if it does not have a description.
    • getExtraProperties

      public final Map<String,List<String>> getExtraProperties()
      Description copied from interface: SchemaElement
      Returns an unmodifiable map containing all of the extra properties associated with this schema element.
      Specified by:
      getExtraProperties in interface SchemaElement
      Returns:
      An unmodifiable map containing all of the extra properties associated with this schema element.
    • toString

      public final String toString()
      Returns the string representation of this schema element as defined in RFC 2252.
      Overrides:
      toString in class Object
      Returns:
      The string representation of this schema element as defined in RFC 2252.