Class TypeFactory


  • public final class TypeFactory
    extends java.lang.Object
    The factory class TypeFactory for creating Type objects
    • Constructor Summary

      Constructors 
      Constructor Description
      TypeFactory()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> java.lang.reflect.Type newCollectionTypeToken​(java.lang.Class<T> collectionType)
      Factory method for create a new Type for convert all derived Collection objects
      static <T extends java.util.Collection,​E>
      java.lang.reflect.Type
      newCollectionTypeToken​(java.lang.Class<T> collectionClass, java.lang.Class<E> elementClass)
      Factory method for create a new Type for convert json objects from all derived Collection objects
      static <T> java.lang.reflect.Type newListTypeToken​(java.lang.Class<T> listType)
      Factory method for create a new Type for convert List objects
      static <K,​V>
      java.lang.reflect.Type
      newMapTypeToken​(java.lang.Class<K> keyType, java.lang.Class<V> valueType)
      Factory method for create a new Type for convert json objects from all derived Map objects
      static <M,​K,​V>
      java.lang.reflect.Type
      newMapTypeToken​(java.lang.Class<M> mapClass, java.lang.Class<K> keyType, java.lang.Class<V> valueType)
      Factory method for create a new Type for convert json objects from all derived Map objects
      • Methods inherited from class java.lang.Object

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

      • TypeFactory

        public TypeFactory()
    • Method Detail

      • newListTypeToken

        public static <T> java.lang.reflect.Type newListTypeToken​(java.lang.Class<T> listType)
        Factory method for create a new Type for convert List objects
        Parameters:
        listType - the list type
        Returns:
        the new Type object
      • newCollectionTypeToken

        public static <T extends java.util.Collection,​E> java.lang.reflect.Type newCollectionTypeToken​(java.lang.Class<T> collectionClass,
                                                                                                             java.lang.Class<E> elementClass)
        Factory method for create a new Type for convert json objects from all derived Collection objects
        Parameters:
        collectionClass - the collection class
        elementClass - the element class
        Returns:
        the new Type object
      • newCollectionTypeToken

        public static <T> java.lang.reflect.Type newCollectionTypeToken​(java.lang.Class<T> collectionType)
        Factory method for create a new Type for convert all derived Collection objects
        Parameters:
        collectionType - the collection type
        Returns:
        the new Type object
      • newMapTypeToken

        public static <M,​K,​V> java.lang.reflect.Type newMapTypeToken​(java.lang.Class<M> mapClass,
                                                                                 java.lang.Class<K> keyType,
                                                                                 java.lang.Class<V> valueType)
        Factory method for create a new Type for convert json objects from all derived Map objects
        Parameters:
        mapClass - the map class
        keyType - the key type class
        valueType - the value type class
        Returns:
        the new Type object
      • newMapTypeToken

        public static <K,​V> java.lang.reflect.Type newMapTypeToken​(java.lang.Class<K> keyType,
                                                                         java.lang.Class<V> valueType)
        Factory method for create a new Type for convert json objects from all derived Map objects
        Parameters:
        keyType - the key type class
        valueType - the value type class
        Returns:
        the new Type object