Class KeyType

  • All Implemented Interfaces:

    
    public abstract class KeyType<T extends Object>
    
                        

    The purpose of this class is to enable capturing and passing a generic Type. In order to capture the generic type and retain it at runtime, you need to create a subclass (ideally as anonymous inline class) as follows:

    <pre class="code"> KeyType&lt;List&lt;String&gt;&gt; typeRef = new KeyType&lt;List&lt;String&gt;&gt;() {}; </pre> *

    The resulting typeRef instance can then be used to obtain a Type instance that carries the captured parameterized type information at runtime. For more information on "super type tokens" see the link to Neal Gafter's blog post.

    This is inspired by Spring project

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      public class KeyType.Companion
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      String toString() {@inheritDoc}
      Boolean equals(Object other)
      Integer hashCode()
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait