Package org.apache.jackrabbit.oak.json
Class TypeCodes
java.lang.Object
org.apache.jackrabbit.oak.json.TypeCodes
TypeCodes maps between
Type and the code used to prefix
its json serialisation.-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic StringdecodeName(int split, String jsonString) Decode the property name encoded into ajsonStringgiven its split.static intdecodeType(int split, String jsonString) Decode the type encoded intojsonStringgiven its split.static StringEncodes the givenpropertyNameof the givenpropertyTypeinto a json string, which is prefixed with a type code.static intSplits ajsonString, which is prefixed with a type code at the location where the prefix ends.
-
Field Details
-
EMPTY_ARRAY
- See Also:
-
-
Method Details
-
encode
Encodes the givenpropertyNameof the givenpropertyTypeinto a json string, which is prefixed with a type code.- Parameters:
propertyType- type of the propertypropertyName- name of the property- Returns:
- type code prefixed json string
-
split
Splits ajsonString, which is prefixed with a type code at the location where the prefix ends.- Parameters:
jsonString- json string to split- Returns:
- the location where the prefix ends or -1 if no prefix is present
-
decodeType
Decode the type encoded intojsonStringgiven its split.- Parameters:
split- split of the json stringjsonString- json string- Returns:
- decoded type.
PropertyType.UNDEFINEDif none or split is not withinjsonString.
-
decodeName
Decode the property name encoded into ajsonStringgiven its split.- Parameters:
split- split of the json stringjsonString- json string- Returns:
- decoded property name. Or
jsonStringif split is not withjsonString.
-