Class TypeTag


  • public final class TypeTag
    extends java.lang.Object
    Represents a generic type, including raw type and generic type parameters. If the type is not generic, the genericTypes list will be empty.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static TypeTag NULL
      Null object for TypeTag.
    • Constructor Summary

      Constructors 
      Constructor Description
      TypeTag​(java.lang.Class<?> type, TypeTag... genericTypes)
      Constructor.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)
      java.util.List<TypeTag> getGenericTypes()  
      <T> java.lang.Class<T> getType()  
      int hashCode()
      static TypeTag of​(java.lang.reflect.Field field, TypeTag enclosingType)
      Resolves a TypeTag from the type of a Field instance, using an enclosing type to determine any generic parameters the field may contain.
      java.lang.String toString()
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • NULL

        public static final TypeTag NULL
        Null object for TypeTag.
    • Constructor Detail

      • TypeTag

        public TypeTag​(java.lang.Class<?> type,
                       TypeTag... genericTypes)
        Constructor.
        Parameters:
        type - The raw type.
        genericTypes - A list of TypeTags for each generic type parameter.
    • Method Detail

      • of

        public static TypeTag of​(java.lang.reflect.Field field,
                                 TypeTag enclosingType)
        Resolves a TypeTag from the type of a Field instance, using an enclosing type to determine any generic parameters the field may contain.
        Parameters:
        field - The field to resolve.
        enclosingType - The type that contains the field, used to determine any generic parameters it may contain.
        Returns:
        The TypeTag for the given field.
      • getType

        public <T> java.lang.Class<T> getType()
        Type Parameters:
        T - The returned Class will have this generic type.
        Returns:
        The TypeTag's raw type.
      • getGenericTypes

        public java.util.List<TypeTag> getGenericTypes()
        Returns:
        The TypeTag's generic types.
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

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

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object