Class TypeLiteral<T>

java.lang.Object
io.bootique.di.TypeLiteral<T>

public class TypeLiteral<T> extends Object
This class represents any generic type T, as there is no support for this in Java.

Usage:

     TypeLiteralg<List<Integer>> type = new TypeLiteral<List<Integer>>(){};
 
  • Constructor Details

    • TypeLiteral

      protected TypeLiteral()
  • Method Details

    • of

      public static <T> TypeLiteral<T> of(Class<T> type)
    • of

      public static <T> TypeLiteral<T> of(Type type)
    • of

      public static <T> TypeLiteral<T> of(Class<T> rawType, Type... parameters)
    • listOf

      public static <T> TypeLiteral<List<T>> listOf(Class<? extends T> type)
      Creates TypeLiteral that represents List<T> type.
    • listOf

      public static <T> TypeLiteral<List<T>> listOf(TypeLiteral<? extends T> type)
      Creates TypeLiteral that represents List<T> type.
    • setOf

      public static <T> TypeLiteral<Set<T>> setOf(Class<? extends T> valueType)
      Creates TypeLiteral that represents Set<T< type.
    • setOf

      public static <T> TypeLiteral<Set<T>> setOf(TypeLiteral<? extends T> valueType)
      Creates TypeLiteral that represents Set<T< type.
    • mapOf

      public static <K, V> TypeLiteral<Map<K,V>> mapOf(Class<? extends K> keyType, Class<? extends V> valueType)
      Creates TypeLiteral that represents Map<K, V< type.
    • mapOf

      public static <K, V> TypeLiteral<Map<K,V>> mapOf(TypeLiteral<? extends K> keyType, TypeLiteral<? extends V> valueType)
      Creates TypeLiteral that represents Map<K, V< type.
    • optionalOf

      public static <T> TypeLiteral<Optional<T>> optionalOf(Class<? extends T> type)
      Creates TypeLiteral that represents Optional<T< type.
    • optionalOf

      public static <T> TypeLiteral<Optional<T>> optionalOf(TypeLiteral<? extends T> type)
      Creates TypeLiteral that represents Optional<T< type.
    • getRawType

      public Class<? super T> getRawType()
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object