Package org.forgerock.opendj.ldap.schema
Class Syntax
- java.lang.Object
-
- org.forgerock.opendj.ldap.schema.Syntax
-
- All Implemented Interfaces:
SchemaElement
public final class Syntax extends Object
This class defines a data structure for storing and interacting with an LDAP syntaxes, which constrain the structure of attribute values stored in an LDAP directory, and determine the representation of attribute and assertion values transferred in the LDAP protocol.Syntax implementations must extend the
SyntaxImpl
interface so they can be used by OpenDJ to validate attribute values.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 class
Syntax.Builder
A fluent API for incrementally constructing syntaxes.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
Returnstrue
if the provided object is an attribute syntax having the same numeric OID as this attribute syntax.MatchingRule
getApproximateMatchingRule()
Retrieves the default approximate matching rule that will be used for attributes with this syntax.String
getDescription()
Returns the description of this schema element, or the empty string if it does not have a description.MatchingRule
getEqualityMatchingRule()
Retrieves the default equality matching rule that will be used for attributes with this syntax.Map<String,List<String>>
getExtraProperties()
Returns an unmodifiable map containing all of the extra properties associated with this schema element.String
getName()
Retrieves the name for this attribute syntax.String
getOid()
Retrieves the OID for this attribute syntax.MatchingRule
getOrderingMatchingRule()
Retrieves the default ordering matching rule that will be used for attributes with this syntax.MatchingRule
getSubstringMatchingRule()
Retrieves the default substring matching rule that will be used for attributes with this syntax.int
hashCode()
Returns the hash code for this attribute syntax.boolean
isBerEncodingRequired()
Indicates whether this attribute syntax requires that values must be encoded using the Basic Encoding Rules (BER) used by X.500 directories and always include thebinary
attribute description option.boolean
isHumanReadable()
Indicates whether this attribute syntax would likely be a human readable string.String
toString()
Returns the string representation of this schema element as defined in RFC 2252.boolean
valueIsAcceptable(ByteSequence value, LocalizableMessageBuilder invalidReason)
Indicates whether the provided value is acceptable for use in an attribute with this syntax.
-
-
-
Method Detail
-
equals
public boolean equals(Object o)
Returnstrue
if the provided object is an attribute syntax having the same numeric OID as this attribute syntax.- Parameters:
o
- The object to be compared.- Returns:
true
if the provided object is an attribute syntax having the same numeric OID as this attribute syntax.
-
getApproximateMatchingRule
public MatchingRule getApproximateMatchingRule()
Retrieves the default approximate matching rule that will be used for attributes with this syntax.- Returns:
- The default approximate matching rule that will be used for
attributes with this syntax, or
null
if approximate matches will not be allowed for this type by default.
-
getEqualityMatchingRule
public MatchingRule getEqualityMatchingRule()
Retrieves the default equality matching rule that will be used for attributes with this syntax.- Returns:
- The default equality matching rule that will be used for
attributes with this syntax, or
null
if equality matches will not be allowed for this type by default.
-
getOid
public String getOid()
Retrieves the OID for this attribute syntax.- Returns:
- The OID for this attribute syntax.
-
getName
public String getName()
Retrieves the name for this attribute syntax.- Returns:
- The name for this attribute syntax.
-
getOrderingMatchingRule
public MatchingRule getOrderingMatchingRule()
Retrieves the default ordering matching rule that will be used for attributes with this syntax.- Returns:
- The default ordering matching rule that will be used for
attributes with this syntax, or
null
if ordering matches will not be allowed for this type by default.
-
getSubstringMatchingRule
public MatchingRule getSubstringMatchingRule()
Retrieves the default substring matching rule that will be used for attributes with this syntax.- Returns:
- The default substring matching rule that will be used for
attributes with this syntax, or
null
if substring matches will not be allowed for this type by default.
-
hashCode
public int hashCode()
Returns the hash code for this attribute syntax. It will be calculated as the hash code of the numeric OID.- Returns:
- The hash code for this attribute syntax.
-
isBerEncodingRequired
public boolean isBerEncodingRequired()
Indicates whether this attribute syntax requires that values must be encoded using the Basic Encoding Rules (BER) used by X.500 directories and always include thebinary
attribute description option.- Returns:
true
this attribute syntax requires that values must be BER encoded and always include thebinary
attribute description option, orfalse
if not.- See Also:
- RFC 4522 - Lightweight Directory Access Protocol (LDAP): The Binary Encoding Option
-
isHumanReadable
public boolean isHumanReadable()
Indicates whether this attribute syntax would likely be a human readable string.- Returns:
true
if this attribute syntax would likely be a human readable string orfalse
if not.
-
valueIsAcceptable
public boolean valueIsAcceptable(ByteSequence value, LocalizableMessageBuilder invalidReason)
Indicates whether the provided value is acceptable for use in an attribute with this syntax. If it is not, then the reason may be appended to the provided buffer.- Parameters:
value
- The value for which to make the determination.invalidReason
- The buffer to which the invalid reason should be appended.- Returns:
true
if the provided value is acceptable for use with this syntax, orfalse
if not.
-
getDescription
public final String getDescription()
Description copied from interface:SchemaElement
Returns the description of this schema element, or the empty string if it does not have a description.- Specified by:
getDescription
in 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:SchemaElement
Returns an unmodifiable map containing all of the extra properties associated with this schema element.- Specified by:
getExtraProperties
in interfaceSchemaElement
- Returns:
- An unmodifiable map containing all of the extra properties associated with this schema element.
-
-