Class GafferCustomTypeFactory


  • public final class GafferCustomTypeFactory
    extends Object
    Class that helps the conversion between Gaffer custom types and standard types that Tinkerpop supports. Tinkerpop only supports a limited number of types so any custom Gaffer ones can only be passed as String representations via Gremlin so need conversion before using in Gaffer Operation chains.
    • Field Detail

      • GRAPHSONV3_TYPES

        public static final List<Class<?>> GRAPHSONV3_TYPES
    • Method Detail

      • parseAsCustomTypeIfValid

        public static Object parseAsCustomTypeIfValid​(Object value)
        Returns a the relevant Object e.g. TypeSubTypeValue from the supplied value or ID, usually by parsing a specifically formatted string. As a fallback will give back the original value if no relevant type was found.
         "TypeSubTypeValue[type=alpha,subType=beta,value=gamma]" // returns TypeSubTypeValue object
         "[type=alpha,subType=beta,value=gamma]" // returns TypeSubTypeValue object
         "normalvalue" // returns itself
         
        Parameters:
        value - The value.
        Returns:
        The value as its relevant type.
      • parseForGraphSONv3

        public static Object parseForGraphSONv3​(Object value)
        Parses the given value to make sure it can be used with Tinkerpops GraphSONv3 types. Will convert the value to String representation if type is not compatible or if value is a collection it will convert all the values inside it.
        Parameters:
        value - The value to parse.
        Returns:
        The value in compatible format.