Class Types


  • public class Types
    extends java.lang.Object
    Utilities around TypeToken
    • Constructor Summary

      Constructors 
      Constructor Description
      Types()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static TypeToken<?> deserialize​(java.lang.String string)
      Deserializes the given String-representation in Base64 encoding into a TypeToken.
      static boolean isAssignable​(TypeToken<?> superType, TypeToken<?> subType)
      Returns whether the given 'candidate' superType is a super type of the given 'candidate' subtype.
      static java.lang.String serialize​(TypeToken<?> typeToken)
      Serializes a given TypeToken into a String representation.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Types

        public Types()
    • Method Detail

      • deserialize

        public static final TypeToken<?> deserialize​(java.lang.String string)
        Deserializes the given String-representation in Base64 encoding into a TypeToken.
        Parameters:
        string - The String-representation to deserialize.
        Returns:
        The deserialized TypeToken.
      • isAssignable

        public static final boolean isAssignable​(TypeToken<?> superType,
                                                 TypeToken<?> subType)
        Returns whether the given 'candidate' superType is a super type of the given 'candidate' subtype. This is replacement for TypeToken.isAssignableFrom(TypeToken), which has been deprecated and replaced by TypeToken.isSuperTypeOf(TypeToken) in Google Guava 19.0.0. As we want to support various Google Guava versions from 15.0.0 onwards, this methods delegates to the appropriate implementation using reflection.
        Parameters:
        superType - The 'candidate' superType.
        subType - The 'candidate' subType.
        Returns:
        true when the given 'candidate' superType is indeed a super type of the given 'candidate' subType, false otherwise.
      • serialize

        public static final java.lang.String serialize​(TypeToken<?> typeToken)
        Serializes a given TypeToken into a String representation.
        Parameters:
        typeToken - The TypeToken to serialize.
        Returns:
        The string representation of the TypeToken encoded in Base64.