Package org.apache.jackrabbit.oak.json
Class TypeCodes
- java.lang.Object
-
- org.apache.jackrabbit.oak.json.TypeCodes
-
public final class TypeCodes extends Object
TypeCodes maps betweenType
and the code used to prefix its json serialisation.
-
-
Field Summary
Fields Modifier and Type Field Description static String
EMPTY_ARRAY
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
decodeName(int split, String jsonString)
Decode the property name encoded into ajsonString
given its split.static int
decodeType(int split, String jsonString)
Decode the type encoded intojsonString
given its split.static String
encode(int propertyType, String propertyName)
Encodes the givenpropertyName
of the givenpropertyType
into a json string, which is prefixed with a type code.static int
split(String jsonString)
Splits ajsonString
, which is prefixed with a type code at the location where the prefix ends.
-
-
-
Field Detail
-
EMPTY_ARRAY
public static final String EMPTY_ARRAY
- See Also:
- Constant Field Values
-
-
Method Detail
-
encode
public static String encode(int propertyType, String propertyName)
Encodes the givenpropertyName
of the givenpropertyType
into 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
public static int split(String jsonString)
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
public static int decodeType(int split, String jsonString)
Decode the type encoded intojsonString
given its split.- Parameters:
split
- split of the json stringjsonString
- json string- Returns:
- decoded type.
PropertyType.UNDEFINED
if none or split is not withinjsonString
.
-
-