com.unboundid.ldap.sdk.schema
Class AttributeTypeDefinition

java.lang.Object
  extended by com.unboundid.ldap.sdk.schema.SchemaElement
      extended by com.unboundid.ldap.sdk.schema.AttributeTypeDefinition
All Implemented Interfaces:
java.io.Serializable

@NotMutable
@ThreadSafety(level=COMPLETELY_THREADSAFE)
public final class AttributeTypeDefinition
extends SchemaElement

This class provides a data structure that describes an LDAP attribute type schema element.

See Also:
Serialized Form

Constructor Summary
AttributeTypeDefinition(java.lang.String s)
          Creates a new attribute type from the provided string representation.
AttributeTypeDefinition(java.lang.String oid, java.lang.String[] names, java.lang.String description, boolean isObsolete, java.lang.String superiorType, java.lang.String equalityMatchingRule, java.lang.String orderingMatchingRule, java.lang.String substringMatchingRule, java.lang.String syntaxOID, boolean isSingleValued, boolean isCollective, boolean isNoUserModification, AttributeUsage usage, java.util.Map<java.lang.String,java.lang.String[]> extensions)
          Creates a new attribute type with the provided information.
AttributeTypeDefinition(java.lang.String oid, java.lang.String name, java.lang.String description, java.lang.String equalityMatchingRule, java.lang.String orderingMatchingRule, java.lang.String substringMatchingRule, java.lang.String syntaxOID, boolean isSingleValued, java.util.Map<java.lang.String,java.lang.String[]> extensions)
          Creates a new attribute type with the provided information.
 
Method Summary
 boolean equals(java.lang.Object o)
          Indicates whether the provided object is equal to this schema element.
 java.lang.String getBaseSyntaxOID()
          Retrieves the OID of the syntax for this attribute type, if available.
 java.lang.String getBaseSyntaxOID(Schema schema)
          Retrieves the base OID of the syntax for this attribute type, examining superior types if necessary.
static java.lang.String getBaseSyntaxOID(java.lang.String syntaxOID)
          Retrieves the base OID of the syntax for this attribute type, examining superior types if necessary.
 java.lang.String getDescription()
          Retrieves the description for this attribute type, if available.
 java.lang.String getEqualityMatchingRule()
          Retrieves the name or OID of the equality matching rule for this attribute type, if available.
 java.lang.String getEqualityMatchingRule(Schema schema)
          Retrieves the name or OID of the equality matching rule for this attribute type, examining superior attribute types if necessary.
 java.util.Map<java.lang.String,java.lang.String[]> getExtensions()
          Retrieves the set of extensions for this attribute type.
 java.lang.String getNameOrOID()
          Retrieves the primary name that can be used to reference this attribute type.
 java.lang.String[] getNames()
          Retrieves the set of names for this attribute type.
 java.lang.String getOID()
          Retrieves the OID for this attribute type.
 java.lang.String getOrderingMatchingRule()
          Retrieves the name or OID of the ordering matching rule for this attribute type, if available.
 java.lang.String getOrderingMatchingRule(Schema schema)
          Retrieves the name or OID of the ordering matching rule for this attribute type, examining superior attribute types if necessary.
 java.lang.String getSubstringMatchingRule()
          Retrieves the name or OID of the substring matching rule for this attribute type, if available.
 java.lang.String getSubstringMatchingRule(Schema schema)
          Retrieves the name or OID of the substring matching rule for this attribute type, examining superior attribute types if necessary.
 java.lang.String getSuperiorType()
          Retrieves the name or OID of the superior type for this attribute type, if available.
 AttributeTypeDefinition getSuperiorType(Schema schema)
          Retrieves the superior attribute type definition for this attribute type, if available.
 int getSyntaxMinimumUpperBound()
          Retrieves the value of the minimum upper bound element of the syntax definition for this attribute type, if defined.
 int getSyntaxMinimumUpperBound(Schema schema)
          Retrieves the value of the minimum upper bound element of the syntax definition for this attribute type, if defined.
static int getSyntaxMinimumUpperBound(java.lang.String syntaxOID)
          Retrieves the value of the minimum upper bound element of the syntax definition for this attribute type, if defined.
 java.lang.String getSyntaxOID()
          Retrieves the OID of the syntax for this attribute type, if available.
 java.lang.String getSyntaxOID(Schema schema)
          Retrieves the OID of the syntax for this attribute type, examining superior types if necessary.
 AttributeUsage getUsage()
          Retrieves the attribute usage for this attribute type.
 int hashCode()
          Retrieves a hash code for this schema element.
 boolean hasNameOrOID(java.lang.String s)
          Indicates whether the provided string matches the OID or any of the names for this attribute type.
 boolean isCollective()
          Indicates whether this attribute type is declared collective, and therefore values may be dynamically generated as described in RFC 3671.
 boolean isNoUserModification()
          Indicates whether this attribute type is declared no-user-modification, and therefore attributes of this type will not be allowed to be altered by clients.
 boolean isObsolete()
          Indicates whether this attribute type is declared obsolete.
 boolean isOperational()
          Indicates whether this attribute type has an operational attribute usage.
 boolean isSingleValued()
          Indicates whether this attribute type is declared single-valued, and therefore attributes of this type will only be allowed to have at most one value.
 java.lang.String toString()
          Retrieves a string representation of this attribute type definition, in the format described in RFC 4512 section 4.1.2.
 
Methods inherited from class com.unboundid.ldap.sdk.schema.SchemaElement
extensionsEqual
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AttributeTypeDefinition

public AttributeTypeDefinition(java.lang.String s)
                        throws LDAPException
Creates a new attribute type from the provided string representation.

Parameters:
s - The string representation of the attribute type to create, using the syntax described in RFC 4512 section 4.1.2. It must not be null.
Throws:
LDAPException - If the provided string cannot be decoded as an attribute type definition.

AttributeTypeDefinition

public AttributeTypeDefinition(java.lang.String oid,
                               java.lang.String name,
                               java.lang.String description,
                               java.lang.String equalityMatchingRule,
                               java.lang.String orderingMatchingRule,
                               java.lang.String substringMatchingRule,
                               java.lang.String syntaxOID,
                               boolean isSingleValued,
                               java.util.Map<java.lang.String,java.lang.String[]> extensions)
Creates a new attribute type with the provided information.

Parameters:
oid - The OID for this attribute type. It must not be null.
name - The name for this attribute type. It may be null if the attribute type should only be referenced by OID.
description - The description for this attribute type. It may be null if there is no description.
equalityMatchingRule - The name or OID of the equality matching rule for this attribute type. It may be null if a default rule is to be inherited.
orderingMatchingRule - The name or OID of the ordering matching rule for this attribute type. It may be null if a default rule is to be inherited.
substringMatchingRule - The name or OID of the substring matching rule for this attribute type. It may be null if a default rule is to be inherited.
syntaxOID - The syntax OID for this attribute type. It may be null if a default syntax is to be inherited.
isSingleValued - Indicates whether attributes of this type are only allowed to have a single value.
extensions - The set of extensions for this attribute type. It may be null or empty if there should not be any extensions.

AttributeTypeDefinition

public AttributeTypeDefinition(java.lang.String oid,
                               java.lang.String[] names,
                               java.lang.String description,
                               boolean isObsolete,
                               java.lang.String superiorType,
                               java.lang.String equalityMatchingRule,
                               java.lang.String orderingMatchingRule,
                               java.lang.String substringMatchingRule,
                               java.lang.String syntaxOID,
                               boolean isSingleValued,
                               boolean isCollective,
                               boolean isNoUserModification,
                               AttributeUsage usage,
                               java.util.Map<java.lang.String,java.lang.String[]> extensions)
Creates a new attribute type with the provided information.

Parameters:
oid - The OID for this attribute type. It must not be null.
names - The set of names for this attribute type. It may be null or empty if the attribute type should only be referenced by OID.
description - The description for this attribute type. It may be null if there is no description.
isObsolete - Indicates whether this attribute type is declared obsolete.
superiorType - The name or OID of the superior attribute type. It may be null if there is no superior type.
equalityMatchingRule - The name or OID of the equality matching rule for this attribute type. It may be null if a default rule is to be inherited.
orderingMatchingRule - The name or OID of the ordering matching rule for this attribute type. It may be null if a default rule is to be inherited.
substringMatchingRule - The name or OID of the substring matching rule for this attribute type. It may be null if a default rule is to be inherited.
syntaxOID - The syntax OID for this attribute type. It may be null if a default syntax is to be inherited.
isSingleValued - Indicates whether attributes of this type are only allowed to have a single value.
isCollective - Indicates whether this attribute type should be considered collective.
isNoUserModification - Indicates whether clients should be allowed to modify attributes of this type.
usage - The attribute usage for this attribute type. It may be null if the default usage of userApplications is to be used.
extensions - The set of extensions for this attribute type. It may be null or empty if there should not be any extensions.
Method Detail

getOID

public java.lang.String getOID()
Retrieves the OID for this attribute type.

Returns:
The OID for this attribute type.

getNames

public java.lang.String[] getNames()
Retrieves the set of names for this attribute type.

Returns:
The set of names for this attribute type, or an empty array if it does not have any names.

getNameOrOID

public java.lang.String getNameOrOID()
Retrieves the primary name that can be used to reference this attribute type. If one or more names are defined, then the first name will be used. Otherwise, the OID will be returned.

Returns:
The primary name that can be used to reference this attribute type.

hasNameOrOID

public boolean hasNameOrOID(java.lang.String s)
Indicates whether the provided string matches the OID or any of the names for this attribute type.

Parameters:
s - The string for which to make the determination. It must not be null.
Returns:
true if the provided string matches the OID or any of the names for this attribute type, or false if not.

getDescription

public java.lang.String getDescription()
Retrieves the description for this attribute type, if available.

Returns:
The description for this attribute type, or null if there is no description defined.

isObsolete

public boolean isObsolete()
Indicates whether this attribute type is declared obsolete.

Returns:
true if this attribute type is declared obsolete, or false if it is not.

getSuperiorType

public java.lang.String getSuperiorType()
Retrieves the name or OID of the superior type for this attribute type, if available.

Returns:
The name or OID of the superior type for this attribute type, or null if no superior type is defined.

getSuperiorType

public AttributeTypeDefinition getSuperiorType(Schema schema)
Retrieves the superior attribute type definition for this attribute type, if available.

Parameters:
schema - The schema to use to get the superior attribute type.
Returns:
The superior attribute type definition for this attribute type, or null if no superior type is defined, or if the superior type is not included in the provided schema.

getEqualityMatchingRule

public java.lang.String getEqualityMatchingRule()
Retrieves the name or OID of the equality matching rule for this attribute type, if available.

Returns:
The name or OID of the equality matching rule for this attribute type, or null if no equality matching rule is defined or a default rule will be inherited.

getEqualityMatchingRule

public java.lang.String getEqualityMatchingRule(Schema schema)
Retrieves the name or OID of the equality matching rule for this attribute type, examining superior attribute types if necessary.

Parameters:
schema - The schema to use to get the superior attribute type.
Returns:
The name or OID of the equality matching rule for this attribute type, or null if no equality matching rule is defined.

getOrderingMatchingRule

public java.lang.String getOrderingMatchingRule()
Retrieves the name or OID of the ordering matching rule for this attribute type, if available.

Returns:
The name or OID of the ordering matching rule for this attribute type, or null if no ordering matching rule is defined or a default rule will be inherited.

getOrderingMatchingRule

public java.lang.String getOrderingMatchingRule(Schema schema)
Retrieves the name or OID of the ordering matching rule for this attribute type, examining superior attribute types if necessary.

Parameters:
schema - The schema to use to get the superior attribute type.
Returns:
The name or OID of the ordering matching rule for this attribute type, or null if no ordering matching rule is defined.

getSubstringMatchingRule

public java.lang.String getSubstringMatchingRule()
Retrieves the name or OID of the substring matching rule for this attribute type, if available.

Returns:
The name or OID of the substring matching rule for this attribute type, or null if no substring matching rule is defined or a default rule will be inherited.

getSubstringMatchingRule

public java.lang.String getSubstringMatchingRule(Schema schema)
Retrieves the name or OID of the substring matching rule for this attribute type, examining superior attribute types if necessary.

Parameters:
schema - The schema to use to get the superior attribute type.
Returns:
The name or OID of the substring matching rule for this attribute type, or null if no substring matching rule is defined.

getSyntaxOID

public java.lang.String getSyntaxOID()
Retrieves the OID of the syntax for this attribute type, if available. It may optionally include a minimum upper bound in curly braces.

Returns:
The OID of the syntax for this attribute type, or null if the syntax will be inherited.

getSyntaxOID

public java.lang.String getSyntaxOID(Schema schema)
Retrieves the OID of the syntax for this attribute type, examining superior types if necessary. It may optionally include a minimum upper bound in curly braces.

Parameters:
schema - The schema to use to get the superior attribute type.
Returns:
The OID of the syntax for this attribute type, or null if no syntax is defined.

getBaseSyntaxOID

public java.lang.String getBaseSyntaxOID()
Retrieves the OID of the syntax for this attribute type, if available. If the attribute type definition includes a minimum upper bound in curly braces, it will be removed from the value that is returned.

Returns:
The OID of the syntax for this attribute type, or null if the syntax will be inherited.

getBaseSyntaxOID

public java.lang.String getBaseSyntaxOID(Schema schema)
Retrieves the base OID of the syntax for this attribute type, examining superior types if necessary. If the attribute type definition includes a minimum upper bound in curly braces, it will be removed from the value that is returned.

Parameters:
schema - The schema to use to get the superior attribute type, if necessary.
Returns:
The OID of the syntax for this attribute type, or null if no syntax is defined.

getBaseSyntaxOID

public static java.lang.String getBaseSyntaxOID(java.lang.String syntaxOID)
Retrieves the base OID of the syntax for this attribute type, examining superior types if necessary. If the attribute type definition includes a minimum upper bound in curly braces, it will be removed from the value that is returned.

Parameters:
syntaxOID - The syntax OID (optionally including the minimum upper bound element) to examine.
Returns:
The OID of the syntax for this attribute type, or null if no syntax is defined.

getSyntaxMinimumUpperBound

public int getSyntaxMinimumUpperBound()
Retrieves the value of the minimum upper bound element of the syntax definition for this attribute type, if defined. If a minimum upper bound is present (as signified by an integer value in curly braces immediately following the syntax OID without any space between them), then it should serve as an indication to the directory server that it should be prepared to handle values with at least that number of (possibly multi-byte) characters.

Returns:
The value of the minimum upper bound element of the syntax definition for this attribute type, or -1 if no syntax is defined defined or if it does not have a valid minimum upper bound.

getSyntaxMinimumUpperBound

public int getSyntaxMinimumUpperBound(Schema schema)
Retrieves the value of the minimum upper bound element of the syntax definition for this attribute type, if defined. If a minimum upper bound is present (as signified by an integer value in curly braces immediately following the syntax OID without any space between them), then it should serve as an indication to the directory server that it should be prepared to handle values with at least that number of (possibly multi-byte) characters.

Parameters:
schema - The schema to use to get the superior attribute type, if necessary.
Returns:
The value of the minimum upper bound element of the syntax definition for this attribute type, or -1 if no syntax is defined defined or if it does not have a valid minimum upper bound.

getSyntaxMinimumUpperBound

public static int getSyntaxMinimumUpperBound(java.lang.String syntaxOID)
Retrieves the value of the minimum upper bound element of the syntax definition for this attribute type, if defined. If a minimum upper bound is present (as signified by an integer value in curly braces immediately following the syntax OID without any space between them), then it should serve as an indication to the directory server that it should be prepared to handle values with at least that number of (possibly multi-byte) characters.

Parameters:
syntaxOID - The syntax OID (optionally including the minimum upper bound element) to examine.
Returns:
The value of the minimum upper bound element of the provided syntax OID, or -1 if the provided syntax OID is null or does not have a valid minimum upper bound.

isSingleValued

public boolean isSingleValued()
Indicates whether this attribute type is declared single-valued, and therefore attributes of this type will only be allowed to have at most one value.

Returns:
true if this attribute type is declared single-valued, or false if not.

isCollective

public boolean isCollective()
Indicates whether this attribute type is declared collective, and therefore values may be dynamically generated as described in RFC 3671.

Returns:
true if this attribute type is declared collective, or false if not.

isNoUserModification

public boolean isNoUserModification()
Indicates whether this attribute type is declared no-user-modification, and therefore attributes of this type will not be allowed to be altered by clients.

Returns:
true if this attribute type is declared no-user-modification, or false if not.

getUsage

public AttributeUsage getUsage()
Retrieves the attribute usage for this attribute type.

Returns:
The attribute usage for this attribute type.

isOperational

public boolean isOperational()
Indicates whether this attribute type has an operational attribute usage.

Returns:
true if this attribute type has an operational attribute usage, or false if not.

getExtensions

public java.util.Map<java.lang.String,java.lang.String[]> getExtensions()
Retrieves the set of extensions for this attribute type. They will be mapped from the extension name (which should start with "X-") to the set of values for that extension.

Returns:
The set of extensions for this attribute type.

hashCode

public int hashCode()
Retrieves a hash code for this schema element.

Specified by:
hashCode in class SchemaElement
Returns:
A hash code for this schema element.

equals

public boolean equals(java.lang.Object o)
Indicates whether the provided object is equal to this schema element.

Specified by:
equals in class SchemaElement
Parameters:
o - The object for which to make the determination.
Returns:
true if the provided object may be considered equal to this schema element, or false if not.

toString

public java.lang.String toString()
Retrieves a string representation of this attribute type definition, in the format described in RFC 4512 section 4.1.2.

Specified by:
toString in class SchemaElement
Returns:
A string representation of this attribute type definition.