org.opends.server.types
Class MatchingRuleUse

java.lang.Object
  extended by org.opends.server.types.MatchingRuleUse
All Implemented Interfaces:
SchemaFileElement

@PublicAPI(stability=UNCOMMITTED,
           mayInstantiate=false,
           mayExtend=false,
           mayInvoke=true)
public final class MatchingRuleUse
extends java.lang.Object
implements SchemaFileElement

This class defines a data structure for storing and interacting with a matching rule use definition, which may be used to restrict the set of attribute types that may be used for a given matching rule.


Constructor Summary
MatchingRuleUse(java.lang.String definition, MatchingRule matchingRule, java.util.Map<java.lang.String,java.lang.String> names, java.lang.String description, boolean isObsolete, java.util.Set<AttributeType> attributes, java.util.Map<java.lang.String,java.util.List<java.lang.String>> extraProperties)
          Creates a new matching rule use definition with the provided information.
 
Method Summary
 boolean appliesToAttribute(AttributeType attributeType)
          Indicates whether the provided attribute type is referenced by this matching rule use.
 boolean equals(java.lang.Object o)
          Indicates whether the provided object is equal to this matching rule use.
 java.util.Set<AttributeType> getAttributes()
          Retrieves the set of attributes associated with this matching rule use.
 java.lang.String getDefinition()
          Retrieves the definition string used to create this matching rule use.
 java.lang.String getDescription()
          Retrieves the description for this matching rule use.
 java.util.Map<java.lang.String,java.util.List<java.lang.String>> getExtraProperties()
          Retrieves a mapping between the names of any extra non-standard properties that may be associated with this matching rule use and the value for that property.
 java.util.List<java.lang.String> getExtraProperty(java.lang.String propertyName)
          Retrieves the value of the specified "extra" property for this matching rule use.
 MatchingRule getMatchingRule()
          Retrieves the matching rule for this matching rule use.
 java.lang.String getName()
          Retrieves the primary name to use when referencing this matching rule use.
 java.util.Map<java.lang.String,java.lang.String> getNames()
          Retrieves the set of names for this matching rule use.
 java.lang.String getSchemaFile()
          Retrieves the path to the schema file that contains the definition for this matching rule use.
 int hashCode()
          Retrieves the hash code for this matching rule use.
 boolean hasName(java.lang.String lowerName)
          Indicates whether this matching rule use has the specified name.
 boolean isObsolete()
          Indicates whether this matching rule use is declared "obsolete".
 MatchingRuleUse recreateFromDefinition()
          Creates a new instance of this matching rule use based on the definition string.
 void setExtraProperty(java.lang.String name, java.util.List<java.lang.String> values)
          Specifies the provided "extra" property for this matching rule use.
 void setExtraProperty(java.lang.String name, java.lang.String value)
          Specifies the provided "extra" property for this matching rule use.
 void setSchemaFile(java.lang.String schemaFile)
          Specifies the path to the schema file that contains the definition for this matching rule use.
 java.lang.String toString()
          Retrieves the string representation of this matching rule use in the form specified in RFC 2252.
 void toString(java.lang.StringBuilder buffer, boolean includeFileElement)
          Appends a string representation of this matching rule use in the form specified in RFC 2252 to the provided buffer.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MatchingRuleUse

public MatchingRuleUse(java.lang.String definition,
                       MatchingRule matchingRule,
                       java.util.Map<java.lang.String,java.lang.String> names,
                       java.lang.String description,
                       boolean isObsolete,
                       java.util.Set<AttributeType> attributes,
                       java.util.Map<java.lang.String,java.util.List<java.lang.String>> extraProperties)
Creates a new matching rule use definition with the provided information.

Parameters:
definition - The definition string used to create this matching rule use. It must not be null.
matchingRule - The matching rule for this matching rule use. It must not be null.
names - The set of names for this matching rule use.
description - The description for this matching rule use.
isObsolete - Indicates whether this matching rule use is declared "obsolete".
attributes - The set of attribute types for this matching rule use.
extraProperties - A set of "extra" properties that may be associated with this matching rule use.
Method Detail

getDefinition

public java.lang.String getDefinition()
Retrieves the definition string used to create this matching rule use.

Specified by:
getDefinition in interface SchemaFileElement
Returns:
The definition string used to create this matching rule use.

recreateFromDefinition

public MatchingRuleUse recreateFromDefinition()
                                       throws DirectoryException
Creates a new instance of this matching rule use based on the definition string. It will also preserve other state information associated with this matching rule use that is not included in the definition string (e.g., the name of the schema file with which it is associated).

Specified by:
recreateFromDefinition in interface SchemaFileElement
Returns:
The new instance of this matching rule use based on the definition string.
Throws:
DirectoryException - If a problem occurs while attempting to create a new matching rule use instance from the definition string.

getMatchingRule

public MatchingRule getMatchingRule()
Retrieves the matching rule for this matching rule use.

Returns:
The matching rule for this matching rule use.

getNames

public java.util.Map<java.lang.String,java.lang.String> getNames()
Retrieves the set of names for this matching rule use. The mapping will be between the names in all lowercase form and the names in the user-defined form.

Returns:
The set of names for this matching rule use.

getName

public java.lang.String getName()
Retrieves the primary name to use when referencing this matching rule use.

Returns:
The primary name to use when referencing this matching rule use, or null if there is none.

hasName

public boolean hasName(java.lang.String lowerName)
Indicates whether this matching rule use has the specified name.

Parameters:
lowerName - The name for which to make the determination, formatted in all lowercase characters.
Returns:
true if this matching rule use has the specified name, or false if not.

getSchemaFile

public java.lang.String getSchemaFile()
Retrieves the path to the schema file that contains the definition for this matching rule use.

Specified by:
getSchemaFile in interface SchemaFileElement
Returns:
The path to the schema file that contains the definition for this matching rule use, or null if it is not known or if it is not stored in any schema file.

setSchemaFile

public void setSchemaFile(java.lang.String schemaFile)
Specifies the path to the schema file that contains the definition for this matching rule use.

Specified by:
setSchemaFile in interface SchemaFileElement
Parameters:
schemaFile - The path to the schema file that contains the definition for this matching rule use.

getDescription

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

Returns:
The description for this matching rule use, or null if there is none.

isObsolete

public boolean isObsolete()
Indicates whether this matching rule use is declared "obsolete".

Returns:
true if this matching rule use is declared "obsolete", or false if it is not.

getAttributes

public java.util.Set<AttributeType> getAttributes()
Retrieves the set of attributes associated with this matching rule use.

Returns:
The set of attributes associated with this matching rule use.

appliesToAttribute

public boolean appliesToAttribute(AttributeType attributeType)
Indicates whether the provided attribute type is referenced by this matching rule use.

Parameters:
attributeType - The attribute type for which to make the determination.
Returns:
true if the provided attribute type is referenced by this matching rule use, or false if it is not.

getExtraProperties

public java.util.Map<java.lang.String,java.util.List<java.lang.String>> getExtraProperties()
Retrieves a mapping between the names of any extra non-standard properties that may be associated with this matching rule use and the value for that property.

Returns:
A mapping between the names of any extra non-standard properties that may be associated with this matching rule use and the value for that property.

getExtraProperty

public java.util.List<java.lang.String> getExtraProperty(java.lang.String propertyName)
Retrieves the value of the specified "extra" property for this matching rule use.

Parameters:
propertyName - The name of the "extra" property for which to retrieve the value.
Returns:
The value of the specified "extra" property for this matching rule use, or null if no such property is defined.

setExtraProperty

public void setExtraProperty(java.lang.String name,
                             java.lang.String value)
Specifies the provided "extra" property for this matching rule use.

Parameters:
name - The name for the "extra" property. It must not be null.
value - The value for the "extra" property, or null if the property is to be removed.

setExtraProperty

public void setExtraProperty(java.lang.String name,
                             java.util.List<java.lang.String> values)
Specifies the provided "extra" property for this matching rule use.

Parameters:
name - The name for the "extra" property. It must not be null.
values - The set of value for the "extra" property, or null if the property is to be removed.

equals

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

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 use, or false if not.

hashCode

public int hashCode()
Retrieves the hash code for this matching rule use. It will be equal to the hash code for the associated matching rule.

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

toString

public java.lang.String toString()
Retrieves the string representation of this matching rule use in the form specified in RFC 2252.

Overrides:
toString in class java.lang.Object
Returns:
The string representation of this matching rule use in the form specified in RFC 2252.

toString

public void toString(java.lang.StringBuilder buffer,
                     boolean includeFileElement)
Appends a string representation of this matching rule use in the form specified in RFC 2252 to the provided buffer.

Parameters:
buffer - The buffer to which the information should be appended.
includeFileElement - Indicates whether to include an "extra" property that specifies the path to the schema file from which this matching rule use was loaded.