org.opends.server.api
Class AbstractMatchingRule

java.lang.Object
  extended by org.opends.server.api.AbstractMatchingRule
All Implemented Interfaces:
MatchingRule
Direct Known Subclasses:
ApproximateMatchingRule, CaseExactOrderingMatchingRule, CaseIgnoreOrderingMatchingRule, EqualityMatchingRule, GeneralizedTimeOrderingMatchingRule, HistoricalCsnOrderingMatchingRule, IntegerOrderingMatchingRule, NumericStringOrderingMatchingRule, OctetStringOrderingMatchingRule, SubstringMatchingRule, UUIDOrderingMatchingRule

@PublicAPI(stability=VOLATILE,
           mayInstantiate=false,
           mayExtend=true,
           mayInvoke=false)
public abstract class AbstractMatchingRule
extends java.lang.Object
implements MatchingRule

This class provides default implementation of MatchingRule. A matching rule implemented by a Directory Server module must extend this class.


Constructor Summary
AbstractMatchingRule()
           
 
Method Summary
 boolean equals(java.lang.Object o)
          Indicates whether the provided object is equal to this matching rule.
abstract  java.util.Collection<java.lang.String> getAllNames()
          Retrieves all names for this matching rule.
abstract  java.lang.String getDescription()
          Retrieves the description for this matching rule.
abstract  java.lang.String getName()
          Retrieves the common name for this matching rule.
 java.lang.String getNameOrOID()
          Retrieves the name or OID for this matching rule.
abstract  java.lang.String getOID()
          Retrieves the OID for this matching rule.
abstract  java.lang.String getSyntaxOID()
          Retrieves the OID of the syntax with which this matching rule is associated.
 int hashCode()
          Retrieves the hash code for this matching rule.
 boolean isObsolete()
          Indicates whether this matching rule is declared "OBSOLETE".
 ByteString normalizeAssertionValue(ByteSequence value)
          Retrieves the normalized form of the provided assertion value, which is best suite for efficiently performing matching operations on that value.
abstract  ByteString normalizeValue(ByteSequence value)
          Retrieves the normalized form of the provided value, which is best suite for efficiently performing matching operations on that value.
 java.lang.String toString()
          Retrieves a string representation of this matching rule in the format defined in RFC 2252.
 void toString(java.lang.StringBuilder buffer)
          Appends a string representation of this matching rule in the format defined in RFC 2252 to the provided buffer.
 ConditionResult valuesMatch(ByteSequence attributeValue, ByteSequence assertionValue)
          Indicates whether the provided attribute value should be considered a match for the given assertion value.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractMatchingRule

public AbstractMatchingRule()
Method Detail

getName

public abstract java.lang.String getName()
Retrieves the common name for this matching rule.

Specified by:
getName in interface MatchingRule
Returns:
The common name for this matching rule, or null if it does not have a name.

getAllNames

public abstract java.util.Collection<java.lang.String> getAllNames()
Retrieves all names for this matching rule.

Specified by:
getAllNames in interface MatchingRule
Returns:
All names for this matching rule.

getOID

public abstract java.lang.String getOID()
Retrieves the OID for this matching rule.

Specified by:
getOID in interface MatchingRule
Returns:
The OID for this matching rule.

normalizeAssertionValue

public ByteString normalizeAssertionValue(ByteSequence value)
                                   throws DirectoryException
Retrieves the normalized form of the provided assertion value, which is best suite for efficiently performing matching operations on that value.

Specified by:
normalizeAssertionValue in interface MatchingRule
Parameters:
value - The assertion value to be normalized.
Returns:
The normalized version of the provided value.
Throws:
DirectoryException - If the provided value is invalid according to the associated attribute syntax.

getNameOrOID

public final java.lang.String getNameOrOID()
Retrieves the name or OID for this matching rule. If it has a name, then it will be returned. Otherwise, the OID will be returned.

Specified by:
getNameOrOID in interface MatchingRule
Returns:
The name or OID for this matching rule.

getDescription

public abstract java.lang.String getDescription()
Retrieves the description for this matching rule.

Specified by:
getDescription in interface MatchingRule
Returns:
The description for this matching rule, or null if there is none.

getSyntaxOID

public abstract java.lang.String getSyntaxOID()
Retrieves the OID of the syntax with which this matching rule is associated.

Specified by:
getSyntaxOID in interface MatchingRule
Returns:
The OID of the syntax with which this matching rule is associated.

isObsolete

public boolean isObsolete()
Indicates whether this matching rule is declared "OBSOLETE". The default implementation will always return false. If that is not acceptable for a particular matching rule implementation, then it should override this method and perform the appropriate processing to return the correct value.

Specified by:
isObsolete in interface MatchingRule
Returns:
true if this matching rule is declared "OBSOLETE", or false if not.

normalizeValue

public abstract ByteString normalizeValue(ByteSequence value)
                                   throws DirectoryException
Retrieves the normalized form of the provided value, which is best suite for efficiently performing matching operations on that value.

Specified by:
normalizeValue in interface MatchingRule
Parameters:
value - The value to be normalized.
Returns:
The normalized version of the provided value.
Throws:
DirectoryException - If the provided value is invalid according to the associated attribute syntax.

valuesMatch

public ConditionResult valuesMatch(ByteSequence attributeValue,
                                   ByteSequence assertionValue)
Indicates whether the provided attribute value should be considered a match for the given assertion value. This will only be used for the purpose of extensible matching. Subclasses should define more specific methods that are appropriate to the matching rule type.

Specified by:
valuesMatch in interface MatchingRule
Parameters:
attributeValue - The attribute value in a form that has been normalized according to this matching rule.
assertionValue - The assertion value in a form that has been normalized according to this matching rule.
Returns:
TRUE if the attribute value should be considered a match for the provided assertion value, FALSE if it does not match, or UNDEFINED if the result is undefined.

hashCode

public final int hashCode()
Retrieves the hash code for this matching rule. It will be calculated as the sum of the characters in the OID.

Overrides:
hashCode in class java.lang.Object
Returns:
The hash code for this matching rule.

equals

public final boolean equals(java.lang.Object o)
Indicates whether the provided object is equal to this matching rule. The provided object will be considered equal to this matching rule only if it is a matching rule with the same OID.

Overrides:
equals in class java.lang.Object
Parameters:
o - The object for which to make the determination.
Returns:
true if the provided object is equal to this matching rule, or false if it is not.

toString

public final java.lang.String toString()
Retrieves a string representation of this matching rule in the format defined in RFC 2252.

Overrides:
toString in class java.lang.Object
Returns:
A string representation of this matching rule in the format defined in RFC 2252.

toString

public final void toString(java.lang.StringBuilder buffer)
Appends a string representation of this matching rule in the format defined in RFC 2252 to the provided buffer.

Specified by:
toString in interface MatchingRule
Parameters:
buffer - The buffer to which the information should be appended.