Package org.forgerock.opendj.rest2ldap
Class SimplePropertyMapper
java.lang.Object
org.forgerock.opendj.rest2ldap.PropertyMapper
org.forgerock.opendj.rest2ldap.SimplePropertyMapper
An property mapper which provides a simple mapping from a JSON value to a single LDAP attribute.
-
Method Summary
Modifier and TypeMethodDescriptiondecoder
(Function<ByteString, ?, ? extends Exception> f) Sets the decoder which will be used for converting LDAP attribute values to JSON values.defaultJsonValue
(Object defaultValue) Sets the default JSON value which should be substituted when the LDAP attribute is not found in the LDAP entry.defaultJsonValues
(Collection<?> defaultValues) Sets the default JSON values which should be substituted when the LDAP attribute is not found in the LDAP entry.encoder
(Function<Object, ByteString, ? extends Exception> f) Sets the encoder which will be used for converting JSON values to LDAP attribute values.isBinary
(boolean isBinary) Indicates that JSON values are base 64 encodings of binary data.final SimplePropertyMapper
isMultiValued
(boolean isMultiValued) Indicates that the LDAP attribute is multi-valued and should be represented in JSON using an array of values.final SimplePropertyMapper
isRequired
(boolean isRequired) Indicates that the LDAP attribute is mandatory and must be provided during create requests.jsonSchema
(JsonValue jsonSchema) Sets the JSON schema corresponding to this simple property mapper.static void
putTypeAndFormat
(JsonValue jsonSchema, AttributeType attrType) Puts the type and format corresponding to the provided attribute type on the provided JSON schema.static void
putWritabilityProperties
(WritabilityPolicy writabilityPolicy, JsonValue jsonSchema) toString()
final SimplePropertyMapper
writability
(WritabilityPolicy policy) Indicates whether the LDAP attribute supports updates.
-
Method Details
-
decoder
Sets the decoder which will be used for converting LDAP attribute values to JSON values.- Parameters:
f
- The function to use for decoding LDAP attribute values.- Returns:
- This property mapper.
-
defaultJsonValue
Sets the default JSON value which should be substituted when the LDAP attribute is not found in the LDAP entry.- Parameters:
defaultValue
- The default JSON value.- Returns:
- This property mapper.
-
defaultJsonValues
Sets the default JSON values which should be substituted when the LDAP attribute is not found in the LDAP entry.- Parameters:
defaultValues
- The default JSON values.- Returns:
- This property mapper.
-
encoder
Sets the encoder which will be used for converting JSON values to LDAP attribute values.- Parameters:
f
- The function to use for encoding LDAP attribute values.- Returns:
- This property mapper.
-
isBinary
Indicates that JSON values are base 64 encodings of binary data. Calling this method with the valuetrue
is equivalent to the following:mapper.decoder(...); // function that converts binary data to base 64 mapper.encoder(...); // function that converts base 64 to binary data
Passing in a value offalse
resets the encoding and decoding functions to the default.- Parameters:
isBinary
-true
if this property is binary.- Returns:
- This property mapper.
-
jsonSchema
Sets the JSON schema corresponding to this simple property mapper. If notnull
, it will be returned bytoJsonSchema()
, otherwise a default JSON schema will be automatically generated with the information available in this property mapper.- Parameters:
jsonSchema
- the JSON schema corresponding to this simple property mapper. Can benull
- Returns:
- This property mapper.
-
toString
-
putTypeAndFormat
Puts the type and format corresponding to the provided attribute type on the provided JSON schema.- Parameters:
jsonSchema
- the JSON schema where to put the type and formatattrType
- the attribute type for which to infer JSON the type and format- See Also:
-
isRequired
Indicates that the LDAP attribute is mandatory and must be provided during create requests.- Parameters:
isRequired
-true
if this property is required.- Returns:
- This property mapper.
-
isMultiValued
Indicates that the LDAP attribute is multi-valued and should be represented in JSON using an array of values.- Parameters:
isMultiValued
-true
if this property is multi-valued.- Returns:
- This property mapper.
-
writability
Indicates whether the LDAP attribute supports updates. The default isWritabilityPolicy.READ_WRITE
.- Parameters:
policy
- The writability policy.- Returns:
- This property mapper.
-
putWritabilityProperties
public static void putWritabilityProperties(WritabilityPolicy writabilityPolicy, JsonValue jsonSchema)
-