Package org.forgerock.opendj.ldap.schema
Interface SyntaxImpl
-
public interface SyntaxImplThis interface defines the set of methods and structures that must be implemented to define a new attribute syntax.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default ByteStringfromJson(Schema schema, Object value)Decodes the JSON representation of an attribute value with this syntax.default StringgetApproximateMatchingRule()Retrieves the default approximate matching rule that will be used for attributes with this syntax.default StringgetEqualityMatchingRule()Retrieves the default equality matching rule that will be used for attributes with this syntax.StringgetName()Retrieves the common name for this attribute syntax.default StringgetOrderingMatchingRule()Retrieves the default ordering matching rule that will be used for attributes with this syntax.default StringgetSubstringMatchingRule()Retrieves the default substring matching rule that will be used for attributes with this syntax.default booleanisBerEncodingRequired()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 thebinaryattribute description option.default booleanisHumanReadable()Indicates whether this attribute syntax would likely be a human readable string.default ObjecttoJson(Schema schema, ByteString value)Encodes the JSON representation of an attribute value with this syntax.default Map<String,Object>toJsonSchema(Schema schema)Returns the JSON schema describing this syntax.booleanvalueIsAcceptable(Schema schema, ByteString value, LocalizableMessageBuilder invalidReason)Indicates whether the provided value is acceptable for use in an attribute with this syntax.
-
-
-
Method Detail
-
getApproximateMatchingRule
default String 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
nullif approximate matches will not be allowed for this type by default.
-
getEqualityMatchingRule
default String 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
nullif equality matches will not be allowed for this type by default.
-
getName
String getName()
Retrieves the common name for this attribute syntax.- Returns:
- The common name for this attribute syntax.
-
getOrderingMatchingRule
default String 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
nullif ordering matches will not be allowed for this type by default.
-
getSubstringMatchingRule
default String 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
nullif substring matches will not be allowed for this type by default.
-
isBerEncodingRequired
default 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 thebinaryattribute description option.- Returns:
truethis attribute syntax requires that values must be BER encoded and always include thebinaryattribute description option, orfalseif not.- See Also:
- RFC 4522 - Lightweight Directory Access Protocol (LDAP): The Binary Encoding Option
-
isHumanReadable
default boolean isHumanReadable()
Indicates whether this attribute syntax would likely be a human readable string.- Returns:
trueif this attribute syntax would likely be a human readable string orfalseif not.
-
valueIsAcceptable
boolean valueIsAcceptable(Schema schema, ByteString 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:
schema- The schema in which this syntax is defined.value- The value for which to make the determination.invalidReason- The buffer to which the invalid reason should be appended.- Returns:
trueif the provided value is acceptable for use with this syntax, orfalseif not.
-
toJson
default Object toJson(Schema schema, ByteString value)
Encodes the JSON representation of an attribute value with this syntax. The default implementation is to encode the value as a UTF-8 string if the syntax is human readable, or base 64 encode the value otherwise.- Parameters:
schema- The schema in which this syntax is defined.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
default ByteString fromJson(Schema schema, Object value)
Decodes the JSON representation of an attribute value with this syntax. The default implementation is to decode the value as a UTF-8 string if the syntax is human readable, or base 64 decode the value otherwise.- Parameters:
schema- The schema in which this syntax is defined.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.
-
-