Package com.unboundid.ldap.sdk.schema
Class AttributeTypeDefinition
- java.lang.Object
-
- com.unboundid.ldap.sdk.schema.SchemaElement
-
- 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
Constructors Constructor Description 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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.SchemaElementType
getSchemaElementType()
Retrieves the type of schema element that this object represents.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
allowEmptyDescription, extensionsEqual, setAllowEmptyDescription
-
-
-
-
Constructor Detail
-
AttributeTypeDefinition
public AttributeTypeDefinition(@NotNull 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 benull
.- Throws:
LDAPException
- If the provided string cannot be decoded as an attribute type definition.
-
AttributeTypeDefinition
public AttributeTypeDefinition(@NotNull java.lang.String oid, @Nullable java.lang.String name, @Nullable java.lang.String description, @Nullable java.lang.String equalityMatchingRule, @Nullable java.lang.String orderingMatchingRule, @Nullable java.lang.String substringMatchingRule, @Nullable java.lang.String syntaxOID, boolean isSingleValued, @Nullable 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 benull
.name
- The name for this attribute type. It may benull
if the attribute type should only be referenced by OID.description
- The description for this attribute type. It may benull
if there is no description.equalityMatchingRule
- The name or OID of the equality matching rule for this attribute type. It may benull
if a default rule is to be inherited.orderingMatchingRule
- The name or OID of the ordering matching rule for this attribute type. It may benull
if a default rule is to be inherited.substringMatchingRule
- The name or OID of the substring matching rule for this attribute type. It may benull
if a default rule is to be inherited.syntaxOID
- The syntax OID for this attribute type. It may benull
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 benull
or empty if there should not be any extensions.
-
AttributeTypeDefinition
public AttributeTypeDefinition(@NotNull java.lang.String oid, @Nullable java.lang.String[] names, @Nullable java.lang.String description, boolean isObsolete, @Nullable java.lang.String superiorType, @Nullable java.lang.String equalityMatchingRule, @Nullable java.lang.String orderingMatchingRule, @Nullable java.lang.String substringMatchingRule, @Nullable java.lang.String syntaxOID, boolean isSingleValued, boolean isCollective, boolean isNoUserModification, @Nullable AttributeUsage usage, @Nullable 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 benull
.names
- The set of names for this attribute type. It may benull
or empty if the attribute type should only be referenced by OID.description
- The description for this attribute type. It may benull
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 benull
if there is no superior type.equalityMatchingRule
- The name or OID of the equality matching rule for this attribute type. It may benull
if a default rule is to be inherited.orderingMatchingRule
- The name or OID of the ordering matching rule for this attribute type. It may benull
if a default rule is to be inherited.substringMatchingRule
- The name or OID of the substring matching rule for this attribute type. It may benull
if a default rule is to be inherited.syntaxOID
- The syntax OID for this attribute type. It may benull
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 benull
if the default usage of userApplications is to be used.extensions
- The set of extensions for this attribute type. It may benull
or empty if there should not be any extensions.
-
-
Method Detail
-
getOID
@NotNull public java.lang.String getOID()
Retrieves the OID for this attribute type.- Returns:
- The OID for this attribute type.
-
getNames
@NotNull 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
@NotNull 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(@NotNull 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 benull
.- Returns:
true
if the provided string matches the OID or any of the names for this attribute type, orfalse
if not.
-
getDescription
@Nullable 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, orfalse
if it is not.
-
getSuperiorType
@Nullable 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
@Nullable public AttributeTypeDefinition getSuperiorType(@NotNull 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
@Nullable 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
@Nullable public java.lang.String getEqualityMatchingRule(@NotNull 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
@Nullable 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
@Nullable public java.lang.String getOrderingMatchingRule(@NotNull 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
@Nullable 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
@Nullable public java.lang.String getSubstringMatchingRule(@NotNull 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
@Nullable 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
@Nullable public java.lang.String getSyntaxOID(@NotNull 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
@Nullable 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
@Nullable public java.lang.String getBaseSyntaxOID(@NotNull 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
@Nullable public static java.lang.String getBaseSyntaxOID(@Nullable 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(@NotNull 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(@Nullable 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, orfalse
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, orfalse
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, orfalse
if not.
-
getUsage
@NotNull 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, orfalse
if not.
-
getExtensions
@NotNull 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.
-
getSchemaElementType
@NotNull public SchemaElementType getSchemaElementType()
Retrieves the type of schema element that this object represents.- Specified by:
getSchemaElementType
in classSchemaElement
- Returns:
- The type of schema element that this object represents.
-
hashCode
public int hashCode()
Retrieves a hash code for this schema element.- Specified by:
hashCode
in classSchemaElement
- Returns:
- A hash code for this schema element.
-
equals
public boolean equals(@Nullable java.lang.Object o)
Indicates whether the provided object is equal to this schema element.- Specified by:
equals
in classSchemaElement
- Parameters:
o
- The object for which to make the determination.- Returns:
true
if the provided object may be considered equal to this schema element, orfalse
if not.
-
toString
@NotNull 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 classSchemaElement
- Returns:
- A string representation of this attribute type definition.
-
-