Class TypeVariableName


  • public final class TypeVariableName
    extends TypeName
    • Field Detail

      • name

        public final java.lang.String name
      • bounds

        public final java.util.List<TypeName> bounds
    • Constructor Detail

      • TypeVariableName

        private TypeVariableName​(java.lang.String name,
                                 java.util.List<TypeName> bounds)
      • TypeVariableName

        private TypeVariableName​(java.lang.String name,
                                 java.util.List<TypeName> bounds,
                                 java.util.List<AnnotationSpec> annotations)
    • Method Detail

      • withBounds

        public TypeVariableName withBounds​(java.lang.reflect.Type... bounds)
      • get

        public static TypeVariableName get​(java.lang.String name)
        Returns type variable named name without bounds.
      • get

        public static TypeVariableName get​(java.lang.String name,
                                           TypeName... bounds)
        Returns type variable named name with bounds.
      • get

        public static TypeVariableName get​(java.lang.String name,
                                           java.lang.reflect.Type... bounds)
        Returns type variable named name with bounds.
      • get

        public static TypeVariableName get​(javax.lang.model.type.TypeVariable mirror)
        Returns type variable equivalent to mirror.
      • get

        static TypeVariableName get​(javax.lang.model.type.TypeVariable mirror,
                                    java.util.Map<javax.lang.model.element.TypeParameterElement,​TypeVariableName> typeVariables)
        Make a TypeVariableName for the given TypeMirror. This form is used internally to avoid infinite recursion in cases like Enum<E extends Enum<E>>. When we encounter such a thing, we will make a TypeVariableName without bounds and add that to the typeVariables map before looking up the bounds. Then if we encounter this TypeVariable again while constructing the bounds, we can just return it from the map. And, the code that put the entry in variables will make sure that the bounds are filled in before returning.
      • get

        public static TypeVariableName get​(javax.lang.model.element.TypeParameterElement element)
        Returns type variable equivalent to element.
      • get

        public static TypeVariableName get​(java.lang.reflect.TypeVariable<?> type)
        Returns type variable equivalent to type.