Package 

Class TypeReference

  • All Implemented Interfaces:
    kotlin.Comparable

    
    public abstract class TypeReference<T extends Object>
     implements Comparable<TypeReference<T>>
                        

    This generic abstract class is used for obtaining full generics type information by sub-classing.

    Class is based on ideas from Jackson TypeReference

    Usage is by sub-classing: here is one way to instantiate reference to generic type List<Integer>:

    TypeReference ref = new TypeReference&lt;List&lt;Integer&gt;&gt;() { };
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private final Type type
    • Method Summary

      Modifier and Type Method Description
      Integer compareTo(TypeReference<T> other) The only reason we define this method (and require implementation of Comparable) is to prevent constructing a reference without type information.
      final Type getType() Parameterized type
      • Methods inherited from class kotlin.Comparable

        equals, hashCode, toString
      • Methods inherited from class java.lang.Object

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

      • compareTo

         Integer compareTo(TypeReference<T> other)

        The only reason we define this method (and require implementation of Comparable) is to prevent constructing a reference without type information.