Class TypeKey<T>


  • public class TypeKey<T>
    extends Object

    Unique identifier for a translator instance. Important so we can re-use translators as we navigate the tree, allowing us to store recursive structures.

    Author:
    Jeff Schnitzer
    • Constructor Detail

      • TypeKey

        public TypeKey​(Type type)
      • TypeKey

        public TypeKey​(Type type,
                       TypeKey previous)
        Create a new typekey for a new type but which preserves characteristics of the old typekey (ie annotations). This is used when creating a new typekey for component types.
      • TypeKey

        public TypeKey​(Property prop)
        Create a typekey from a property
    • Method Detail

      • getTypeAsClass

        public Class<T> getTypeAsClass()
        Get the basic class through erasure.
      • getAnnotation

        public <A extends Annotation> A getAnnotation​(Class<A> annotationType)
        Gets the annotation that has the specified type, or null if there isn't one
      • isAnnotationPresent

        public boolean isAnnotationPresent​(Class<? extends Annotation> annotationType)
        Returns:
        true if the annotation is present
      • getAnnotationAnywhere

        public <A extends Annotation> A getAnnotationAnywhere​(Class<A> annotationType)
        Checks not only the listed annotations but also annotations on the class.
      • isAssignableTo

        public boolean isAssignableTo​(Class<?> superclass)
        Can this type be assigned to a variable with the specified type? This is the inverse of isAssignableFrom().