Package org.forgerock.opendj.ldap.schema
Class AttributeType
- java.lang.Object
-
- org.forgerock.opendj.ldap.schema.AttributeType
-
- All Implemented Interfaces:
Comparable<AttributeType>,SchemaElement
public final class AttributeType extends Object implements Comparable<AttributeType>
This class defines a data structure for storing and interacting with an attribute type, which contains information about the format of an attribute and the syntax and matching rules that should be used when interacting with it.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 classAttributeType.BuilderA fluent API for incrementally constructing attribute type.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(AttributeType type)Compares this attribute type to the provided attribute type.booleanequals(Object o)Returnstrueif the provided object is an attribute type having the same numeric OID as this attribute type.MatchingRulegetApproximateMatchingRule()Returns the matching rule that should be used for approximate matching with this attribute type.StringgetDescription()Returns the description of this schema element, or the empty string if it does not have a description.MatchingRulegetEqualityMatchingRule()Returns the matching rule that should be used for equality matching with this attribute type.Map<String,List<String>>getExtraProperties()Returns an unmodifiable map containing all of the extra properties associated with this schema element.StringgetNameOrOid()Returns the name or OID for this schema definition.List<String>getNames()Returns an unmodifiable list containing the user-defined names that may be used to reference this schema definition.StringgetOid()Returns the OID for this schema definition.MatchingRulegetOrderingMatchingRule()Returns the matching rule that should be used for ordering with this attribute type.MatchingRulegetSubstringMatchingRule()Returns the matching rule that should be used for substring matching with this attribute type.Iterable<AttributeType>getSubTypes()Returns the sub-types inheriting directly or indirectly from this attribute type.AttributeTypegetSuperiorType()Returns the superior type for this attribute type.SyntaxgetSyntax()Returns the syntax for this attribute type.AttributeUsagegetUsage()Returns the usage indicator for this attribute type.inthashCode()Returns the hash code for this attribute type.booleanhasName(String name)Indicates whether this schema definition has the specified name.booleanhasNameOrOid(String value)Indicates whether this schema definition has the specified name or OID.booleanhasSubTypes()Returns whether this attribute type has sub-types, inheriting directly or indirectly from this attribute type.booleanisCollective()Indicates whether this attribute type is declared "collective".booleanisNoUserModification()Indicates whether this attribute type is declared "no-user-modification".booleanisObjectClass()Indicates whether this attribute type is theobjectClassattribute type having the OID 2.5.4.0.booleanisObsolete()Indicates whether this schema definition is declared "obsolete".booleanisOperational()Indicates whether this is an operational attribute.booleanisPlaceHolder()Indicates whether this attribute type is a temporary place-holder allocated dynamically by a non-strict schema when no registered attribute type was found.booleanisSingleValue()Indicates whether this attribute type is declared "single-value".booleanisSubTypeOf(AttributeType type)Indicates whether this attribute type is a sub-type of the provided attribute type.booleanisSuperTypeOf(AttributeType type)Indicates whether this attribute type is a super-type of the provided attribute type.booleanmatches(AttributeType type)Implements a place-holder tolerant version ofequals(java.lang.Object).AttributeDescriptiontoAttributeDescription()Returns the option-less attribute description corresponding to this attribute type.StringtoString()Returns the string representation of this schema element as defined in RFC 2252.
-
-
-
Method Detail
-
compareTo
public int compareTo(AttributeType type)
Compares this attribute type to the provided attribute type. The sort-order is defined as follows:- The
objectClassattribute is less than all other attribute types. - User attributes are less than operational attributes.
- Lexicographic comparison of the primary name and then, if equal, the OID.
- Specified by:
compareToin interfaceComparable<AttributeType>- Parameters:
type- The attribute type to be compared.- Returns:
- A negative integer, zero, or a positive integer as this attribute type is less than, equal to, or greater than the specified attribute type.
- Throws:
NullPointerException- Ifnamewasnull.
- The
-
equals
public boolean equals(Object o)
Returnstrueif the provided object is an attribute type having the same numeric OID as this attribute type.- Parameters:
o- The object to be compared.- Returns:
trueif the provided object is an attribute type having the same numeric OID as this attribute type.
-
getApproximateMatchingRule
public MatchingRule getApproximateMatchingRule()
Returns the matching rule that should be used for approximate matching with this attribute type.- Returns:
- The matching rule that should be used for approximate matching with this attribute type.
-
getSubTypes
public Iterable<AttributeType> getSubTypes()
Returns the sub-types inheriting directly or indirectly from this attribute type.- Returns:
- the sub-types inheriting directly or indirectly from this attribute type
-
hasSubTypes
public boolean hasSubTypes()
Returns whether this attribute type has sub-types, inheriting directly or indirectly from this attribute type.- Returns:
trueif this attribute type has sub-types,falseotherwise
-
getEqualityMatchingRule
public MatchingRule getEqualityMatchingRule()
Returns the matching rule that should be used for equality matching with this attribute type.- Returns:
- The matching rule that should be used for equality matching with this attribute type.
-
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.
-
getOrderingMatchingRule
public MatchingRule getOrderingMatchingRule()
Returns the matching rule that should be used for ordering with this attribute type.- Returns:
- The matching rule that should be used for ordering with this attribute type.
-
getSubstringMatchingRule
public MatchingRule getSubstringMatchingRule()
Returns the matching rule that should be used for substring matching with this attribute type.- Returns:
- The matching rule that should be used for substring matching with this attribute type.
-
getSuperiorType
public AttributeType getSuperiorType()
Returns the superior type for this attribute type.- Returns:
- The superior type for this attribute type, or
nullif it does not have one.
-
getSyntax
public Syntax getSyntax()
Returns the syntax for this attribute type.- Returns:
- The syntax for this attribute type.
-
getUsage
public AttributeUsage getUsage()
Returns the usage indicator for this attribute type.- Returns:
- The usage indicator for this attribute type.
-
hashCode
public int hashCode()
Returns the hash code for this attribute type. It will be calculated as the hash code of the numeric OID.- Returns:
- The hash code for this attribute type.
-
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:
trueif the specified name is assigned to this schema definition,falseotherwise.
-
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:
trueif the provided value matches the OID or one of the names assigned to this schema definition,falseotherwise.
-
isCollective
public boolean isCollective()
Indicates whether this attribute type is declared "collective".- Returns:
trueif this attribute type is declared "collective",falseotherwise.
-
isNoUserModification
public boolean isNoUserModification()
Indicates whether this attribute type is declared "no-user-modification".- Returns:
trueif this attribute type is declared "no-user-modification",falseotherwise.
-
isObjectClass
public boolean isObjectClass()
Indicates whether this attribute type is theobjectClassattribute type having the OID 2.5.4.0.- Returns:
trueif this attribute type is theobjectClassattribute type,falseotherwise.
-
isObsolete
public boolean isObsolete()
Indicates whether this schema definition is declared "obsolete".- Returns:
trueif this schema definition is declared "obsolete",falseotherwise.
-
isOperational
public boolean isOperational()
Indicates whether this is an operational attribute. An operational attribute is one with a usage of "directoryOperation", "distributedOperation", or "dSAOperation" (i.e., only userApplications is not operational).- Returns:
trueif this is an operational attribute,falseotherwise.
-
isPlaceHolder
public boolean isPlaceHolder()
Indicates whether this attribute type is a temporary place-holder allocated dynamically by a non-strict schema when no registered attribute type was found.Place holder attribute types have an OID which is the normalized attribute name with the string
-oidappended. In addition, they will use the directory string syntax and case ignore matching rule.- Returns:
trueif this is a temporary place-holder attribute type allocated dynamically by a non-strict schema when no registered attribute type was found.- See Also:
Schema.getAttributeType(String)
-
isSingleValue
public boolean isSingleValue()
Indicates whether this attribute type is declared "single-value".- Returns:
trueif this attribute type is declared "single-value",falseotherwise.
-
isSubTypeOf
public boolean isSubTypeOf(AttributeType type)
Indicates whether this attribute type is a sub-type of the provided attribute type.- Parameters:
type- The attribute type for which to make the determination.- Returns:
trueif this attribute type is a sub-type of the provided attribute type,falseotherwise.- Throws:
NullPointerException- Iftypewasnull.
-
isSuperTypeOf
public boolean isSuperTypeOf(AttributeType type)
Indicates whether this attribute type is a super-type of the provided attribute type.- Parameters:
type- The attribute type for which to make the determination.- Returns:
trueif this attribute type is a super-type of the provided attribute type,falseotherwise.- Throws:
NullPointerException- Iftypewasnull.
-
matches
public boolean matches(AttributeType type)
Implements a place-holder tolerant version ofequals(java.lang.Object). This method returnstruein the following cases:- this attribute type is equal to the provided attribute type as
specified by
equals(java.lang.Object) - this attribute type is a place-holder and the provided attribute type has a name which matches the name of this attribute type
- the provided attribute type is a place-holder and this attribute type has a name which matches the name of the provided attribute type.
- Parameters:
type- The attribute type for which to make the determination.- Returns:
trueif the provided attribute type matches this attribute type.
- this attribute type is equal to the provided attribute type as
specified by
-
toAttributeDescription
public AttributeDescription toAttributeDescription()
Returns the option-less attribute description corresponding to this attribute type.- Returns:
- the option-less attribute description corresponding to this attribute type
-
getDescription
public final String getDescription()
Description copied from interface:SchemaElementReturns the description of this schema element, or the empty string if it does not have a description.- Specified by:
getDescriptionin interfaceSchemaElement- 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:SchemaElementReturns an unmodifiable map containing all of the extra properties associated with this schema element.- Specified by:
getExtraPropertiesin interfaceSchemaElement- Returns:
- An unmodifiable map containing all of the extra properties associated with this schema element.
-
-