Class MatchingRule

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

public final class MatchingRule extends Object
This class defines a data structure for storing and interacting with matching rules, which are used by servers to compare attribute values against assertion values when performing Search and Compare operations. They are also used to identify the value to be added or deleted when modifying entries, and are used when comparing a purported distinguished name with the name of an entry.

Matching rule implementations must extend the MatchingRuleImplementation class so they can be used by OpenDJ.

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

    Modifier and Type
    Method
    Description
    Collection<? extends Indexer>
    Returns the indexers for this matching rule configured using the provided indexing options.
    boolean
    Returns true if the provided object is a matching rule having the same numeric OID as this matching rule.
    Returns the normalized form of the provided assertion value, which is best suited for efficiently performing matching operations on that value.
    final String
    Returns the description of this schema element, or the empty string if it does not have a description.
    Returns an unmodifiable map containing all of the extra properties associated with this schema element.
    Returns the normalized form of the provided assertion value, which is best suited for efficiently performing greater than or equal ordering matching operations on that value.
    Returns the normalized form of the provided assertion value, which is best suited for efficiently performing greater than or equal ordering matching operations on that value.
    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.
    getSubstringAssertion(ByteSequence subInitial, List<? extends ByteSequence> subAnyElements, ByteSequence subFinal)
    Returns the normalized form of the provided assertion substring values, which is best suited for efficiently performing matching operations on that value.
    Returns the OID of the assertion value syntax with which this matching rule is associated.
    int
    Returns the hash code for this matching rule.
    boolean
    Indicates whether this schema definition has the specified name.
    boolean
    Indicates whether this schema definition has the specified name or OID.
    boolean
    Indicates whether this schema definition is declared "obsolete".
    Returns the normalized form of the provided attribute value, which is best suited for efficiently performing matching operations on that value.
    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

    • equals

      public boolean equals(Object o)
      Returns true if the provided object is a matching rule having the same numeric OID as this matching rule.
      Parameters:
      o - The object to be compared.
      Returns:
      true if the provided object is a matching rule having the same numeric OID as this matching rule.
    • getAssertion

      Returns the normalized form of the provided assertion value, which is best suited for efficiently performing matching operations on that value. The assertion value is guaranteed to be valid against this matching rule's assertion syntax.
      Parameters:
      value - The syntax checked assertion value to be normalized.
      Returns:
      The normalized version of the provided assertion value.
      Throws:
      DecodeException - if the syntax of the value is not valid.
    • getSubstringAssertion

      public Assertion getSubstringAssertion(ByteSequence subInitial, List<? extends ByteSequence> subAnyElements, ByteSequence subFinal) throws DecodeException
      Returns the normalized form of the provided assertion substring values, which is best suited for efficiently performing matching operations on that value.
      Parameters:
      subInitial - The normalized substring value fragment that should appear at the beginning of the target value.
      subAnyElements - The normalized substring value fragments that should appear in the middle of the target value.
      subFinal - The normalized substring value fragment that should appear at the end of the target value.
      Returns:
      The normalized version of the provided assertion value.
      Throws:
      DecodeException - if the syntax of the value is not valid.
    • getGreaterOrEqualAssertion

      Returns the normalized form of the provided assertion value, which is best suited for efficiently performing greater than or equal ordering matching operations on that value. The assertion value is guaranteed to be valid against this matching rule's assertion syntax.
      Parameters:
      value - The syntax checked assertion value to be normalized.
      Returns:
      The normalized version of the provided assertion value.
      Throws:
      DecodeException - if the syntax of the value is not valid.
    • getLessOrEqualAssertion

      Returns the normalized form of the provided assertion value, which is best suited for efficiently performing greater than or equal ordering matching operations on that value. The assertion value is guaranteed to be valid against this matching rule's assertion syntax.
      Parameters:
      value - The syntax checked assertion value to be normalized.
      Returns:
      The normalized version of the provided assertion value.
      Throws:
      DecodeException - if the syntax of the value is not valid.
    • createIndexers

      public Collection<? extends Indexer> createIndexers(IndexingOptions options)
      Returns the indexers for this matching rule configured using the provided indexing options.
      Parameters:
      options - The indexing options
      Returns:
      the collection of indexers for this matching rule.
    • 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.
    • getSyntax

      public Syntax getSyntax()
      Returns the OID of the assertion value syntax with which this matching rule is associated.
      Returns:
      The OID of the assertion value syntax with which this matching rule is associated.
    • hashCode

      public int hashCode()
      Returns the hash code for this matching rule. It will be calculated as the hash code of the numeric OID.
      Returns:
      The hash code for this matching rule.
    • 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, or false if not.
    • 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, or false if not.
    • isObsolete

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

      Returns the normalized form of the provided attribute value, which is best suited for efficiently performing matching operations on that value. The returned normalized representation can be compared for equality with other values normalized with this matching rule using ByteSequence.equals(Object). In addition, normalized values can be compared using ByteSequence.compareTo(ByteSequence), although the sort order is only defined for ordering matching rules.
      Parameters:
      value - The attribute value to be normalized.
      Returns:
      The normalized version of the provided attribute value.
      Throws:
      DecodeException - If the syntax of the value is not valid.
    • 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.