Class JsonSchema
- java.lang.Object
-
- org.forgerock.opendj.rest2ldap.schema.JsonSchema
-
public final class JsonSchema extends Object
Utility methods for obtaining JSON syntaxes and matching rules. See the package documentation for more detail.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
JsonSchema.ValidationPolicy
JSON value validation policies.
-
Field Summary
Fields Modifier and Type Field Description static Option<Boolean>
CASE_SENSITIVE_STRINGS
Matching rule option controlling whether JSON string comparisons should be case-sensitive.static String
EMR_CASE_EXACT_JSON_ID_OID
The OID of the case sensitive JSON equality matching rule.static String
EMR_CASE_EXACT_JSON_QUERY_OID
The OID of the case sensitive JSON query equality matching rule.static String
EMR_CASE_IGNORE_JSON_ID_OID
The OID of the case insensitive JSON equality matching rule.static String
EMR_CASE_IGNORE_JSON_QUERY_OID
The OID of the case insensitive JSON query equality matching rule.static String
EMR_JSON_FIRST_COMPONENT_CASE_EXACT_JSON_QUERY_OID
The OID of the jsonFirstComponentCaseExactJsonQueryMatch equality matching rule.static String
EMR_JSON_FIRST_COMPONENT_CASE_IGNORE_JSON_QUERY_OID
The OID of the jsonFirstComponentCaseIgnoreJsonQueryMatch equality matching rule.static String
EMR_NAME_AND_JSON_CASE_EXACT_JSON_ID_OID
The OID of the case sensitive nameAndJsonCaseExactJsonIdEqualityMatch equality matching rule.static String
EMR_NAME_AND_JSON_CASE_IGNORE_JSON_ID_OID
The OID of the case insensitive nameAndJsonCaseIgnoreJsonIdEqualityMatch equality matching rule.static String
EMR_NAME_AND_JSON_CASE_IGNORE_JSON_QUERY_FILTER_OID
The OID of the case insensitive nameAndJsonCaseIgnoreJsonQueryFilterMatch equality matching rule.static String
EMR_NAME_AND_JSON_OID
The OID of the nameAndJsonEqualityMatchingRule equality matching rule.static Option<Boolean>
IGNORE_WHITE_SPACE
Matching rule option controlling whether JSON string comparisons should ignore white-space.static Option<Collection<String>>
INDEXED_FIELD_PATTERNS
Matching rule option controlling which JSON fields should be indexed by the matching rule.static String
SYNTAX_JSON_OID
The OID of the JSON attribute syntax.static String
SYNTAX_JSON_QUERY_OID
The OID of the JSON query attribute syntax.static String
SYNTAX_NAME_AND_JSON_QUERY_FILTER_ASSERTION_OID
The OID of the Name and JSON query filter assertion syntax.static String
SYNTAX_NAME_AND_JSON_WITH_ID_OID
The OID of the Name and JSON attribute syntax.static Option<JsonSchema.ValidationPolicy>
VALIDATION_POLICY
Schema option controlling syntax validation for JSON based attributes.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static SchemaBuilder
addJsonSyntaxesAndMatchingRulesToSchema(SchemaBuilder builder)
Adds the syntaxes and matching rules required by for JSON attribute support to the provided schema builder.static Object
byteStringToJson(ByteString value)
Parses the provided byte string as a JSON value.static Pair<Dn,Object>
byteStringToNameAndJson(Schema schema, ByteString value)
Decodes the provided value as a Name and JSON value.static Dn
byteStringToNameWithoutJson(Schema schema, ByteString value)
Decodes the provided value as a Name and JSON value but without decoding the JSON value.static MatchingRule
getCaseExactJsonIdMatchingRule()
Returns thejsonMatch
matching rule having the OID "1.3.6.1.4.1.36733.2.1.4.5".static MatchingRule
getCaseExactJsonQueryMatchingRule()
Returns thejsonQueryMatch
matching rule having the OID "1.3.6.1.4.1.36733.2.1.4.2".static String
getCaseIgnoreExtensibleJsonOrderingMatchingRule()
Returns the extensible JSON ordering matching rule having the OID "1.3.6.1.4.1.36733.2.1.4.6:".static MatchingRule
getCaseIgnoreJsonIdMatchingRule()
Returns thejsonMatch
matching rule having the OID "1.3.6.1.4.1.36733.2.1.4.4".static MatchingRule
getCaseIgnoreJsonQueryMatchingRule()
Returns thejsonQueryMatch
matching rule having the OID "1.3.6.1.4.1.36733.2.1.4.10".static Schema
getInstance()
Returns aSchema
containing thecore schema
and JSON syntaxes and matching rules.static MatchingRule
getJsonFirstComponentCaseExactJsonQueryMatchingRule()
Returns thejsonFirstComponentJsonQueryMatch
matching rule having the OID "1.3.6.1.4.1.36733.2.1.4.8".static MatchingRule
getJsonFirstComponentCaseIgnoreJsonQueryMatchingRule()
Returns thejsonFirstComponentJsonQueryMatch
matching rule having the OID "1.3.6.1.4.1.36733.2.1.4.9".static Syntax
getJsonQuerySyntax()
Returns the JSON Query attribute syntax having the OID "1.3.6.1.4.1.36733.2.1.3.2".static Syntax
getJsonSyntax()
Returns the JSON attribute syntax having the OID "1.3.6.1.4.1.36733.2.1.3.1".static MatchingRule
getNameAndJsonCaseExactJsonIdMatchingRule()
Returns the "nameAndJsonCaseExactJsonIdEqualityMatch" matching rule having the OID "1.3.6.1.4.1.36733.2.1.4.11".static MatchingRule
getNameAndJsonCaseIgnoreJsonIdMatchingRule()
Returns the "nameAndJsonCaseIgnoreJsonIdEqualityMatch" matching rule having the OID "1.3.6.1.4.1.36733.2.1.4.10".static MatchingRule
getNameAndJsonCaseIgnoreJsonQueryFilterMatchingRule()
Returns the "1.3.6.1.4.1.36733.2.1.4.12" matching rule having the OID "1.3.6.1.4.1.36733.2.1.4.12".static MatchingRule
getNameAndJsonMatchingRule()
Returns thenameAndJsonEqualityMatchingRule
matching rule having the OID "1.3.6.1.4.1.36733.2.1.4.7".static Syntax
getNameAndJsonQueryFilterAssertionSyntax()
Returns the Name with JSON query filter assertion syntax having the OID "1.3.6.1.4.1.36733.2.1.3.13".static Syntax
getNameAndJsonWithIdSyntax()
Returns the Name with JSON attribute syntax having the OID "1.3.6.1.4.1.36733.2.1.3.12".static ByteString
jsonToByteString(Object value)
Converts a JSONObject
to aByteString
representation.static ByteString
nameAndJsonToByteString(ByteString nameAndJsonValue, Dn newName)
static ByteString
nameAndJsonToByteString(Dn name, Object json)
static MatchingRuleImpl
newJsonEqualityMatchingRuleImpl(Collection<JsonPointer> keys, Options options)
Creates a new custom JSON equality matching rule implementation with the provided matching rule name and options.static MatchingRuleImpl
newJsonOrderingMatchingRuleImpl(List<JsonPointer> keys, Options options)
Creates a new custom JSON ordering matching rule implementation with the provided matching rule name and options.static MatchingRuleImpl
newJsonQueryEqualityMatchingRuleImpl(String matchingRuleName, Options options)
Creates a new custom JSON query equality matching rule implementation with the provided matching rule name and options.
-
-
-
Field Detail
-
VALIDATION_POLICY
public static final Option<JsonSchema.ValidationPolicy> VALIDATION_POLICY
Schema option controlling syntax validation for JSON based attributes. By default this compatibility option is set toJsonSchema.ValidationPolicy.STRICT
.
-
CASE_SENSITIVE_STRINGS
public static final Option<Boolean> CASE_SENSITIVE_STRINGS
Matching rule option controlling whether JSON string comparisons should be case-sensitive. By default this compatibility option is set tofalse
meaning that case will be ignored.This option must be provided when constructing a JSON matching rule using
newJsonQueryEqualityMatchingRuleImpl(java.lang.String, org.forgerock.util.Options)
, and cannot be overridden at the schema level.
-
IGNORE_WHITE_SPACE
public static final Option<Boolean> IGNORE_WHITE_SPACE
Matching rule option controlling whether JSON string comparisons should ignore white-space. By default this compatibility option is set totrue
meaning that leading and trailing white-space will be ignored and intermediate white-space will be reduced to a single white-space character.This option must be provided when constructing a JSON matching rule using
newJsonQueryEqualityMatchingRuleImpl(java.lang.String, org.forgerock.util.Options)
, and cannot be overridden at the schema level.
-
INDEXED_FIELD_PATTERNS
public static final Option<Collection<String>> INDEXED_FIELD_PATTERNS
Matching rule option controlling which JSON fields should be indexed by the matching rule. By default all fields will be indexed. To restrict the set of indexed fields specify a list whose values are wild-card patterns for matching against JSON pointers. Patterns are JSON pointers where "*" represents zero or more characters in a single path element, and "**" represents any number of path elements. For example:Pattern examples Pattern Matches Doesn't match /aaa/bbb/ccc /aaa/bbb/ccc /aaa/bbb/ccc/ddd
/aaa/bbb/cccc/aaa/b*/ccc /aaa/bbb/ccc
/aaa/bxx/ccc/aaa/xxx/ccc
/aaa/bbb/aaa/**/ddd /aaa/ddd
/aaa/xxx/yyy/ddd/aaa/bbb/ccc /aaa/** /aaa
/aaa/bbb
/aaa/bbb/ccc/aa
-
SYNTAX_JSON_OID
public static final String SYNTAX_JSON_OID
The OID of the JSON attribute syntax.- See Also:
- Constant Field Values
-
SYNTAX_JSON_QUERY_OID
public static final String SYNTAX_JSON_QUERY_OID
The OID of the JSON query attribute syntax.- See Also:
- Constant Field Values
-
SYNTAX_NAME_AND_JSON_WITH_ID_OID
public static final String SYNTAX_NAME_AND_JSON_WITH_ID_OID
The OID of the Name and JSON attribute syntax.- See Also:
- Constant Field Values
-
EMR_NAME_AND_JSON_OID
public static final String EMR_NAME_AND_JSON_OID
The OID of the nameAndJsonEqualityMatchingRule equality matching rule.- See Also:
- Constant Field Values
-
EMR_JSON_FIRST_COMPONENT_CASE_IGNORE_JSON_QUERY_OID
public static final String EMR_JSON_FIRST_COMPONENT_CASE_IGNORE_JSON_QUERY_OID
The OID of the jsonFirstComponentCaseIgnoreJsonQueryMatch equality matching rule.- See Also:
- Constant Field Values
-
EMR_JSON_FIRST_COMPONENT_CASE_EXACT_JSON_QUERY_OID
public static final String EMR_JSON_FIRST_COMPONENT_CASE_EXACT_JSON_QUERY_OID
The OID of the jsonFirstComponentCaseExactJsonQueryMatch equality matching rule.- See Also:
- Constant Field Values
-
EMR_NAME_AND_JSON_CASE_IGNORE_JSON_ID_OID
public static final String EMR_NAME_AND_JSON_CASE_IGNORE_JSON_ID_OID
The OID of the case insensitive nameAndJsonCaseIgnoreJsonIdEqualityMatch equality matching rule.- See Also:
- Constant Field Values
-
EMR_NAME_AND_JSON_CASE_EXACT_JSON_ID_OID
public static final String EMR_NAME_AND_JSON_CASE_EXACT_JSON_ID_OID
The OID of the case sensitive nameAndJsonCaseExactJsonIdEqualityMatch equality matching rule.- See Also:
- Constant Field Values
-
EMR_CASE_IGNORE_JSON_ID_OID
public static final String EMR_CASE_IGNORE_JSON_ID_OID
The OID of the case insensitive JSON equality matching rule.- See Also:
- Constant Field Values
-
EMR_CASE_EXACT_JSON_ID_OID
public static final String EMR_CASE_EXACT_JSON_ID_OID
The OID of the case sensitive JSON equality matching rule.- See Also:
- Constant Field Values
-
EMR_CASE_IGNORE_JSON_QUERY_OID
public static final String EMR_CASE_IGNORE_JSON_QUERY_OID
The OID of the case insensitive JSON query equality matching rule.- See Also:
- Constant Field Values
-
EMR_CASE_EXACT_JSON_QUERY_OID
public static final String EMR_CASE_EXACT_JSON_QUERY_OID
The OID of the case sensitive JSON query equality matching rule.- See Also:
- Constant Field Values
-
SYNTAX_NAME_AND_JSON_QUERY_FILTER_ASSERTION_OID
public static final String SYNTAX_NAME_AND_JSON_QUERY_FILTER_ASSERTION_OID
The OID of the Name and JSON query filter assertion syntax.- See Also:
- Constant Field Values
-
EMR_NAME_AND_JSON_CASE_IGNORE_JSON_QUERY_FILTER_OID
public static final String EMR_NAME_AND_JSON_CASE_IGNORE_JSON_QUERY_FILTER_OID
The OID of the case insensitive nameAndJsonCaseIgnoreJsonQueryFilterMatch equality matching rule.- See Also:
- Constant Field Values
-
-
Method Detail
-
getInstance
public static Schema getInstance()
Returns aSchema
containing thecore schema
and JSON syntaxes and matching rules.- Returns:
- The schema.
-
getNameAndJsonWithIdSyntax
public static Syntax getNameAndJsonWithIdSyntax()
Returns the Name with JSON attribute syntax having the OID "1.3.6.1.4.1.36733.2.1.3.12". Attribute values of this syntax must be a valid DN, prepended with a JSON object with an_id
property. Example:attribute: {"_id": "anId", "json": "value"}uid=user.2 attribute: {"_id": "anId", json": "valueForEmptyDn"}
By default JSON properties will be ignored by thenameAndJsonEqualityMatchingRule
matching rule, although this may be overridden when defining individual attribute types (see:getNameAndJsonCaseIgnoreJsonIdMatchingRule()
andgetNameAndJsonCaseExactJsonIdMatchingRule()
- Returns:
- The JSON attribute syntax having the OID "1.3.6.1.4.1.36733.2.1.3.12".
-
getNameAndJsonQueryFilterAssertionSyntax
public static Syntax getNameAndJsonQueryFilterAssertionSyntax()
Returns the Name with JSON query filter assertion syntax having the OID "1.3.6.1.4.1.36733.2.1.3.13". Bytestring matching this syntax are made of a query filter surrounded by parenthesis followed by a DN. Example:("field" eq "value")uid=user.2
- Returns:
- The Name with JSON query filter assertion syntax having the OID "1.3.6.1.4.1.36733.2.1.3.13".
-
getJsonSyntax
public static Syntax getJsonSyntax()
Returns the JSON attribute syntax having the OID "1.3.6.1.4.1.36733.2.1.3.1". Attribute values of this syntax must be valid JSON. Use theVALIDATION_POLICY
schema option to control the degree of syntax enforcement. By default JSON attributes will support equality matching using thejsonQueryMatch
matching rule, although this may be overridden when defining individual attribute types.- Returns:
- The JSON attribute syntax having the OID "1.3.6.1.4.1.36733.2.1.3.1".
-
getJsonQuerySyntax
public static Syntax getJsonQuerySyntax()
Returns the JSON Query attribute syntax having the OID "1.3.6.1.4.1.36733.2.1.3.2". Attribute values of this syntax must be valid CREST JSONquery filter
strings as defined inQueryFilterParser
.- Returns:
- The JSON Query attribute syntax having the OID "1.3.6.1.4.1.36733.2.1.3.2".
-
getNameAndJsonMatchingRule
public static MatchingRule getNameAndJsonMatchingRule()
Returns thenameAndJsonEqualityMatchingRule
matching rule having the OID "1.3.6.1.4.1.36733.2.1.4.7". This matching rule will compare the DN part of the attribute while ignoring the JSON part.- Returns:
- The
nameAndJsonEqualityMatchingRule
matching rule having the OID "1.3.6.1.4.1.36733.2.1.4.7".
-
getNameAndJsonCaseIgnoreJsonIdMatchingRule
public static MatchingRule getNameAndJsonCaseIgnoreJsonIdMatchingRule()
Returns the "nameAndJsonCaseIgnoreJsonIdEqualityMatch" matching rule having the OID "1.3.6.1.4.1.36733.2.1.4.10". This matching rule will compare the DN part of the attribute as well as the_id
member of the JSON part. If the_id
member has a string value, the matching rule will use a case insensitive string comparison, and will ignore white space.- Returns:
- The
nameAndJsonCaseIgnoreJsonIdEqualityMatch
matching rule having the OID "1.3.6.1.4.1.36733.2.1.4.10".
-
getNameAndJsonCaseIgnoreJsonQueryFilterMatchingRule
public static MatchingRule getNameAndJsonCaseIgnoreJsonQueryFilterMatchingRule()
Returns the "1.3.6.1.4.1.36733.2.1.4.12" matching rule having the OID "1.3.6.1.4.1.36733.2.1.4.12". This matching rule will compare the DN part of the attribute as well as the JSON part that matches a query filter. The matching rule's assertion syntax is aCREST JSON query filter
. This matching rule will ignore the case when comparing JSON strings as well as ignoring white spaces. In addition, all JSON fields will be indexed if indexing is enabled.- Returns:
- The
nameAndJsonCaseIgnoreJsonQueryMatch
matching rule having the OID "1.3.6.1.4.1.36733.2.1.4.12".
-
getNameAndJsonCaseExactJsonIdMatchingRule
public static MatchingRule getNameAndJsonCaseExactJsonIdMatchingRule()
Returns the "nameAndJsonCaseExactJsonIdEqualityMatch" matching rule having the OID "1.3.6.1.4.1.36733.2.1.4.11". This matching rule will compare the DN part of the attribute as well as the_id
member of the JSON part. If the_id
member has a string value, the matching rule will use a case sensitive string comparison, and will ignore white space.- Returns:
- The "nameAndJsonCaseExactJsonIdEqualityMatch" matching rule having the OID "1.3.6.1.4.1.36733.2.1.4.11".
-
getCaseIgnoreJsonIdMatchingRule
public static MatchingRule getCaseIgnoreJsonIdMatchingRule()
Returns thejsonMatch
matching rule having the OID "1.3.6.1.4.1.36733.2.1.4.4". This matching rule will compare the _id member of JSON objects. If the _id member has a string value, the matching rule will use a case insensitive string comparison, and will ignore white space.- Returns:
- The
jsonMatch
matching rule having the OID "1.3.6.1.4.1.36733.2.1.4.4".
-
getCaseExactJsonIdMatchingRule
public static MatchingRule getCaseExactJsonIdMatchingRule()
Returns thejsonMatch
matching rule having the OID "1.3.6.1.4.1.36733.2.1.4.5". This matching rule will compare the _id member of JSON objects. If the _id member has a string value, the matching rule will use a case sensitive string comparison, and will ignore white space.- Returns:
- The @code jsonMatch} matching rule having the OID "1.3.6.1.4.1.36733.2.1.4.5".
-
getCaseIgnoreJsonQueryMatchingRule
public static MatchingRule getCaseIgnoreJsonQueryMatchingRule()
Returns thejsonQueryMatch
matching rule having the OID "1.3.6.1.4.1.36733.2.1.4.10". The matching rule's assertion syntax is aCREST JSON query filter
. This matching rule will ignore case when comparing JSON strings as well as ignoring white space. In addition, all JSON fields will be indexed if indexing is enabled.- Returns:
- The
jsonQueryMatch
matching rule having the OID "1.3.6.1.4.1.36733.2.1.4.10".
-
getCaseExactJsonQueryMatchingRule
public static MatchingRule getCaseExactJsonQueryMatchingRule()
Returns thejsonQueryMatch
matching rule having the OID "1.3.6.1.4.1.36733.2.1.4.2". The matching rule's assertion syntax is aCREST JSON query filter
. This matching rule will check the case when comparing JSON strings as well as ignoring ignore white space. In addition, all JSON fields will be indexed if indexing is enabled.- Returns:
- The
jsonQueryMatch
matching rule having the OID "1.3.6.1.4.1.36733.2.1.4.2".
-
getJsonFirstComponentCaseIgnoreJsonQueryMatchingRule
public static MatchingRule getJsonFirstComponentCaseIgnoreJsonQueryMatchingRule()
Returns thejsonFirstComponentJsonQueryMatch
matching rule having the OID "1.3.6.1.4.1.36733.2.1.4.9". The matching rule's assertion syntax is aName and JSON
. This matching rule will ignore case when comparing JSON strings as well as ignoring ignore white space. In addition, all JSON fields will be indexed if indexing is enabled.- Returns:
- The
jsonFirstComponentJsonQueryMatch
matching rule having the OID "1.3.6.1.4.1.36733.2.1.4.9".
-
getJsonFirstComponentCaseExactJsonQueryMatchingRule
public static MatchingRule getJsonFirstComponentCaseExactJsonQueryMatchingRule()
Returns thejsonFirstComponentJsonQueryMatch
matching rule having the OID "1.3.6.1.4.1.36733.2.1.4.8". The matching rule's assertion syntax is aName and JSON
. This matching rule will check the case when comparing JSON strings as well as ignoring ignore white space. In addition, all JSON fields will be indexed if indexing is enabled.- Returns:
- The
jsonFirstComponentJsonQueryMatch
matching rule having the OID "1.3.6.1.4.1.36733.2.1.4.8".
-
getCaseIgnoreExtensibleJsonOrderingMatchingRule
public static String getCaseIgnoreExtensibleJsonOrderingMatchingRule()
Returns the extensible JSON ordering matching rule having the OID "1.3.6.1.4.1.36733.2.1.4.6:".The returned string is expected to be concatenated with a colon (:) and the colon (:) separated list of the JSON pointers referencing the entries' fields which must be taken into consideration for the ordering.
- Returns:
- A string format to build an extensible ordering json matching rule.
-
newJsonEqualityMatchingRuleImpl
public static MatchingRuleImpl newJsonEqualityMatchingRuleImpl(Collection<JsonPointer> keys, Options options)
Creates a new custom JSON equality matching rule implementation with the provided matching rule name and options.- Parameters:
keys
- The list of JSON fields to use to normalize a JSON object.options
- The options controlling the behavior of the matching rule.- Returns:
- The new custom JSON equality matching rule implementation.
- See Also:
CASE_SENSITIVE_STRINGS
,IGNORE_WHITE_SPACE
-
newJsonOrderingMatchingRuleImpl
public static MatchingRuleImpl newJsonOrderingMatchingRuleImpl(List<JsonPointer> keys, Options options)
Creates a new custom JSON ordering matching rule implementation with the provided matching rule name and options.- Parameters:
keys
- The list of JSON fields to use to normalize a JSON object.options
- The options controlling the behavior of the matching rule.- Returns:
- The new custom JSON ordering matching rule implementation.
- See Also:
CASE_SENSITIVE_STRINGS
,IGNORE_WHITE_SPACE
-
newJsonQueryEqualityMatchingRuleImpl
public static MatchingRuleImpl newJsonQueryEqualityMatchingRuleImpl(String matchingRuleName, Options options)
Creates a new custom JSON query equality matching rule implementation with the provided matching rule name and options. This method should be used when creating custom JSON matching rules whose behavior differs fromgetCaseIgnoreJsonQueryMatchingRule()
.- Parameters:
matchingRuleName
- The name of the matching rule. This will be used as the index ID in attribute indexes so it must not collide with other indexes identifiers.options
- The options controlling the behavior of the matching rule.- Returns:
- The new custom JSON query equality matching rule implementation.
- See Also:
CASE_SENSITIVE_STRINGS
,IGNORE_WHITE_SPACE
-
addJsonSyntaxesAndMatchingRulesToSchema
public static SchemaBuilder addJsonSyntaxesAndMatchingRulesToSchema(SchemaBuilder builder)
Adds the syntaxes and matching rules required by for JSON attribute support to the provided schema builder.- Parameters:
builder
- The schema builder to which the schema elements should be added.- Returns:
- The schema builder.
-
byteStringToJson
public static Object byteStringToJson(ByteString value)
Parses the provided byte string as a JSON value. Invalid values will result in aLocalizedIllegalArgumentException
.- Parameters:
value
- The value to be parsed.- Returns:
- The parsed
JSON
value. - Throws:
LocalizedIllegalArgumentException
- Ifvalue
is not valid JSON.
-
jsonToByteString
public static ByteString jsonToByteString(Object value) throws com.fasterxml.jackson.core.JsonProcessingException
Converts a JSONObject
to aByteString
representation.- Parameters:
value
- The JSON object to be converted.- Returns:
- The
ByteString
representation. - Throws:
com.fasterxml.jackson.core.JsonProcessingException
- If conversion failed for some reason.
-
byteStringToNameAndJson
public static Pair<Dn,Object> byteStringToNameAndJson(Schema schema, ByteString value)
Decodes the provided value as a Name and JSON value. Invalid values will result in aLocalizedIllegalArgumentException
.- Parameters:
schema
- The schema to use to decode the value.value
- The value to be decoded.- Returns:
- The decoded Name and JSON value.
- Throws:
LocalizedIllegalArgumentException
- Ifvalue
is not a valid Name and JSON.
-
byteStringToNameWithoutJson
public static Dn byteStringToNameWithoutJson(Schema schema, ByteString value)
Decodes the provided value as a Name and JSON value but without decoding the JSON value. Invalid values will result in aLocalizedIllegalArgumentException
.- Parameters:
schema
- The schema to use to decode the value.value
- The value to be decoded.- Returns:
- The decoded name, ignoring the JSON value.
- Throws:
LocalizedIllegalArgumentException
- Ifvalue
is not a valid Name and JSON.
-
nameAndJsonToByteString
public static ByteString nameAndJsonToByteString(Dn name, Object json) throws com.fasterxml.jackson.core.JsonProcessingException
- Parameters:
name
- The name part.json
- The associated JSON properties (ornull
).- Returns:
- The encoded Name and JSON value.
- Throws:
com.fasterxml.jackson.core.JsonProcessingException
- If conversion failed for some reason.
-
nameAndJsonToByteString
public static ByteString nameAndJsonToByteString(ByteString nameAndJsonValue, Dn newName)
Encodes the providednewName
and the JSON contained innameAndJsonValue
into aByteString
.This is an optimization allowing to change the
Dn
of a Name And JSON value without having to fully decode the JSON part.- Parameters:
nameAndJsonValue
- The encoded Name And JSON value.newName
- The new name.- Returns:
- The encoded Name and JSON value.
-
-