Class Syntax

java.lang.Object
org.forgerock.opendj.ldap.schema.Syntax
All Implemented Interfaces:
SchemaElement

public final class Syntax extends Object
This class defines a data structure for storing and interacting with an LDAP syntaxes, which constrain the structure of attribute values stored in an LDAP directory, and determine the representation of attribute and assertion values transferred in the LDAP protocol.

Syntax implementations must extend the SyntaxImpl interface so they can be used by OpenDJ to validate attribute values.

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 syntaxes.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Returns true if the provided object is an attribute syntax having the same numeric OID as this attribute syntax.
    Decodes the JSON representation of an attribute value with this syntax.
    Retrieves the default approximate matching rule that will be used for attributes with this syntax.
    final String
    Returns the description of this schema element, or the empty string if it does not have a description.
    Retrieves the default equality matching rule that will be used for attributes with this syntax.
    Returns an unmodifiable map containing all of the extra properties associated with this schema element.
    Retrieves the name for this attribute syntax.
    Retrieves the OID for this attribute syntax.
    Retrieves the default ordering matching rule that will be used for attributes with this syntax.
    Retrieves the default substring matching rule that will be used for attributes with this syntax.
    int
    Returns the hash code for this attribute syntax.
    boolean
    Indicates whether this attribute syntax requires that values must be encoded using the Basic Encoding Rules (BER) used by X.500 directories and always include the binary attribute description option.
    boolean
    Indicates whether this attribute syntax would likely be a human readable string.
    Encodes the JSON representation of an attribute value with this syntax.
    Returns the JSON schema describing this syntax.
    final String
    Returns the string representation of this schema element as defined in RFC 2252.
    boolean
    Indicates whether the provided value is acceptable for use in an attribute with this syntax.

    Methods inherited from class java.lang.Object

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

    • equals

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

      public MatchingRule getApproximateMatchingRule()
      Retrieves the default approximate matching rule that will be used for attributes with this syntax.
      Returns:
      The default approximate matching rule that will be used for attributes with this syntax, or null if approximate matches will not be allowed for this type by default.
    • getEqualityMatchingRule

      public MatchingRule getEqualityMatchingRule()
      Retrieves the default equality matching rule that will be used for attributes with this syntax.
      Returns:
      The default equality matching rule that will be used for attributes with this syntax, or null if equality matches will not be allowed for this type by default.
    • getOid

      public String getOid()
      Retrieves the OID for this attribute syntax.
      Returns:
      The OID for this attribute syntax.
    • getName

      public String getName()
      Retrieves the name for this attribute syntax.
      Returns:
      The name for this attribute syntax.
    • getOrderingMatchingRule

      public MatchingRule getOrderingMatchingRule()
      Retrieves the default ordering matching rule that will be used for attributes with this syntax.
      Returns:
      The default ordering matching rule that will be used for attributes with this syntax, or null if ordering matches will not be allowed for this type by default.
    • getSubstringMatchingRule

      public MatchingRule getSubstringMatchingRule()
      Retrieves the default substring matching rule that will be used for attributes with this syntax.
      Returns:
      The default substring matching rule that will be used for attributes with this syntax, or null if substring matches will not be allowed for this type by default.
    • hashCode

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

      public boolean isBerEncodingRequired()
      Indicates whether this attribute syntax requires that values must be encoded using the Basic Encoding Rules (BER) used by X.500 directories and always include the binary attribute description option.
      Returns:
      true this attribute syntax requires that values must be BER encoded and always include the binary attribute description option, or false if not.
      See Also:
    • isHumanReadable

      public boolean isHumanReadable()
      Indicates whether this attribute syntax would likely be a human readable string.
      Returns:
      true if this attribute syntax would likely be a human readable string or false if not.
    • valueIsAcceptable

      public boolean valueIsAcceptable(ByteString value, LocalizableMessageBuilder invalidReason)
      Indicates whether the provided value is acceptable for use in an attribute with this syntax. If it is not, then the reason may be appended to the provided buffer.
      Parameters:
      value - The value for which to make the determination.
      invalidReason - The buffer to which the invalid reason should be appended.
      Returns:
      true if the provided value is acceptable for use with this syntax, or false if not.
    • toJson

      public Object toJson(ByteString value)
      Encodes the JSON representation of an attribute value with this syntax.
      Parameters:
      value - The attribute value to be encoded.
      Returns:
      The encoded JSON representation.
      Throws:
      LocalizedIllegalArgumentException - If the provided attribute value does not conform to this syntax.
    • fromJson

      public ByteString fromJson(Object value)
      Decodes the JSON representation of an attribute value with this syntax.
      Parameters:
      value - The JSON representation to be decoded.
      Returns:
      The decoded attribute value.
      Throws:
      LocalizedIllegalArgumentException - If the provided JSON value does not conform to this syntax.
    • toJsonSchema

      public Map<String,Object> toJsonSchema()
      Returns the JSON schema describing this syntax.
      Returns:
      The JSON schema.
    • 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.