Package org.forgerock.opendj.ldap.schema
Class Syntax
java.lang.Object
org.forgerock.opendj.ldap.schema.Syntax
- All Implemented Interfaces:
SchemaElement
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
Modifier and TypeClassDescriptionstatic final class
A fluent API for incrementally constructing syntaxes. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Returnstrue
if the provided object is an attribute syntax having the same numeric OID as this attribute syntax.Decodes the JSON representation of an attribute value with this syntax.Retrieves the default approximate matching rule that will be used for attributes with this syntax.final String
Returns the description of this schema element, or the empty string if it does not have a description.Retrieves the default equality matching rule that will be used for attributes with this syntax.Returns an unmodifiable map containing all of the extra properties associated with this schema element.getName()
Retrieves the name for this attribute syntax.getOid()
Retrieves the OID for this attribute syntax.Retrieves the default ordering matching rule that will be used for attributes with this syntax.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
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
Indicates whether this attribute syntax would likely be a human readable string.toJson
(ByteString value) Encodes the JSON representation of an attribute value with this syntax.Returns the JSON schema describing this syntax.final String
toString()
Returns the string representation of this schema element as defined in RFC 2252.boolean
valueIsAcceptable
(ByteString value, LocalizableMessageBuilder invalidReason) Indicates whether the provided value is acceptable for use in an attribute with this syntax.
-
Method Details
-
equals
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
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
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
Retrieves the OID for this attribute syntax.- Returns:
- The OID for this attribute syntax.
-
getName
Retrieves the name for this attribute syntax.- Returns:
- The name for this attribute syntax.
-
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
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:
-
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
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.
-
toJson
Encodes the JSON representation of an attribute value with this syntax.- Parameters:
value
- The attribute value to be encoded.- Returns:
- The encoded JSON representation.
- Throws:
LocalizedIllegalArgumentException
- If the provided attribute value does not conform to this syntax.
-
fromJson
Decodes the JSON representation of an attribute value with this syntax.- Parameters:
value
- The JSON representation to be decoded.- Returns:
- The decoded attribute value.
- Throws:
LocalizedIllegalArgumentException
- If the provided JSON value does not conform to this syntax.
-
toJsonSchema
Returns the JSON schema describing this syntax.- Returns:
- The JSON schema.
-
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
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.
-
toString
Returns the string representation of this schema element as defined in RFC 2252.
-