Class TypeCodes

java.lang.Object
org.apache.jackrabbit.oak.json.TypeCodes

public final class TypeCodes extends Object
TypeCodes maps between Type and the code used to prefix its json serialisation.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    decodeName(int split, String jsonString)
    Decode the property name encoded into a jsonString given its split.
    static int
    decodeType(int split, String jsonString)
    Decode the type encoded into jsonString given its split.
    static String
    encode(int propertyType, String propertyName)
    Encodes the given propertyName of the given propertyType into a json string, which is prefixed with a type code.
    static int
    split(String jsonString)
    Splits a jsonString, which is prefixed with a type code at the location where the prefix ends.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Method Details

    • encode

      public static String encode(int propertyType, String propertyName)
      Encodes the given propertyName of the given propertyType into a json string, which is prefixed with a type code.
      Parameters:
      propertyType - type of the property
      propertyName - name of the property
      Returns:
      type code prefixed json string
    • split

      public static int split(String jsonString)
      Splits a jsonString, 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 into jsonString given its split.
      Parameters:
      split - split of the json string
      jsonString - json string
      Returns:
      decoded type. PropertyType.UNDEFINED if none or split is not within jsonString.
    • decodeName

      public static String decodeName(int split, String jsonString)
      Decode the property name encoded into a jsonString given its split.
      Parameters:
      split - split of the json string
      jsonString - json string
      Returns:
      decoded property name. Or jsonString if split is not with jsonString.