Package org.forgerock.opendj.ldap.schema
Class MatchingRule
java.lang.Object
org.forgerock.opendj.ldap.schema.MatchingRule
- All Implemented Interfaces:
SchemaElement
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
Modifier and TypeClassDescriptionstatic final class
A fluent API for incrementally constructing matching rules.static enum
Represents the types of matching rules, according to RFC 4517 section 4.1. -
Method Summary
Modifier and TypeMethodDescriptionCollection<? extends Indexer>
createIndexers
(IndexingOptions options) Returns the indexers for this matching rule configured using the provided indexing options.boolean
Returnstrue
if the provided object is a matching rule having the same numeric OID as this matching rule.getAssertion
(ByteString assertionValue) Compiles the provided assertion value as anAssertion
suitable for use with equalityMatch, approxMatch and extensibleMatch search filters.Returns the OID of the assertion value syntax with which this matching rule is associated.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.getGreaterOrEqualAssertion
(ByteString assertionValue) Compiles the provided ordering assertion value as anAssertion
suitable for use with greaterOrEqual search filters.getLessOrEqualAssertion
(ByteString assertionValue) Compiles the provided ordering assertion value as anAssertion
suitable for use with lessOrEqual search filters.Returns the name or OID for this schema definition.getNames()
Returns an unmodifiable list containing the user-defined names that may be used to reference this schema definition.getOid()
Returns the OID for this schema definition.getOrderingAssertion
(ByteString lower, ByteString upper, boolean lowerIncluded, boolean upperIncluded) Compiles the provided ordering assertion value range as anAssertion
suitable for use with ordering search filters, including greaterOrEqual and lessOrEqual.getSubstringAssertion
(ByteString subInitial, List<ByteString> subAnyElements, ByteString subFinal) Compiles the provided substring assertion fragments as anAssertion
suitable for use with substrings search filters.getType()
Returns the type of the matching rule.int
hashCode()
Returns the hash code for this matching rule.boolean
Indicates whether this schema definition has the specified name.boolean
hasNameOrOid
(String value) 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
toString()
Returns the string representation of this schema element as defined in RFC 2252.
-
Method Details
-
equals
Returnstrue
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.
-
getType
Returns the type of the matching rule.- Returns:
- the type of the matching rule.
-
getAssertion
Compiles the provided assertion value as anAssertion
suitable for use with equalityMatch, approxMatch and extensibleMatch search filters.- Parameters:
assertionValue
- The assertion value.- Returns:
- The compiled assertion.
- Throws:
DecodeException
- If the assertion value does not conform to the matching rule's assertion syntax.
-
getSubstringAssertion
public Assertion getSubstringAssertion(ByteString subInitial, List<ByteString> subAnyElements, ByteString subFinal) throws DecodeException Compiles the provided substring assertion fragments as anAssertion
suitable for use with substrings search filters.- Parameters:
subInitial
- The substring value fragment that should appear at the beginning of the target value.subAnyElements
- The substring value fragments that should appear in the middle of the target value.subFinal
- The substring value fragment that should appear at the end of the target value.- Returns:
- The compiled substring assertion.
- Throws:
DecodeException
- If the assertion value fragments do not conform to the matching rule's assertion syntax or if the matching rule does not support substring matching.
-
getOrderingAssertion
public Assertion getOrderingAssertion(ByteString lower, ByteString upper, boolean lowerIncluded, boolean upperIncluded) throws DecodeException Compiles the provided ordering assertion value range as anAssertion
suitable for use with ordering search filters, including greaterOrEqual and lessOrEqual.- Parameters:
lower
- The lower bound assertion value, ornull
if there is no lower bound and the range will start from the smallest key.upper
- The upper bound assertion value to be normalized, ornull
if there is no upper bound and the range will end at the largest key.lowerIncluded
-true
if a key exactly matching the lower bound is included in the range,false
if only keys strictly greater than the lower bound are included. This value is ignored if the lower bound is not specified.upperIncluded
-true
if a key exactly matching the upper bound is included in the range,false
if only keys strictly less than the upper bound are included. This value is ignored if the upper bound is not specified.- Returns:
- The compiled ordering assertion.
- Throws:
DecodeException
- If the upper or lower bounds do not conform to the matching rule's assertion syntax or if the matching rule does not support ordering matching.
-
getGreaterOrEqualAssertion
Compiles the provided ordering assertion value as anAssertion
suitable for use with greaterOrEqual search filters.- Parameters:
assertionValue
- The lower bound assertion value, which values must be greater than or equal to.- Returns:
- The compiled ordering assertion.
- Throws:
DecodeException
- If the assertion value does not conform to the matching rule's assertion syntax or if the matching rule does not support ordering matching.
-
getLessOrEqualAssertion
Compiles the provided ordering assertion value as anAssertion
suitable for use with lessOrEqual search filters.- Parameters:
assertionValue
- The upper bound assertion value, which values must be less than or equal to.- Returns:
- The compiled ordering assertion.
- Throws:
DecodeException
- If the assertion value does not conform to the matching rule's assertion syntax or if the matching rule does not support ordering matching.
-
createIndexers
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
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
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
Returns the OID for this schema definition.- Returns:
- The OID for this schema definition.
-
getAssertionSyntax
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
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, orfalse
if not.
-
hasNameOrOid
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, orfalse
if not.
-
isObsolete
public boolean isObsolete()Indicates whether this schema definition is declared "obsolete".- Returns:
true
if this schema definition is declared "obsolete", orfalse
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 usingByteString.equals(Object)
. In addition, normalized values can be compared usingByteString.compareTo(ByteString)
, 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
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 interfaceSchemaElement
- Returns:
- The description of this schema element, or the empty string if it does not have a description.
-
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 interfaceSchemaElement
- Returns:
- An unmodifiable map containing all of the extra properties associated with this schema element.
-
toString
Returns the string representation of this schema element as defined in RFC 2252.
-