Class TypeBindings


  • public final class TypeBindings
    extends java.lang.Object
    Helper class used for storing binding of local type variables to matching resolved types, in context of a single class.
    • Field Detail

      • NO_STRINGS

        private static final java.lang.String[] NO_STRINGS
      • _names

        private final java.lang.String[] _names
        Array of type (type variable) names.
      • _types

        private final ResolvedType[] _types
        Types matching names
      • _unboundVariables

        private final java.lang.String[] _unboundVariables
        Names of potentially unresolved type variables.
        Since:
        2.3
      • _hashCode

        private final int _hashCode
    • Constructor Detail

      • TypeBindings

        private TypeBindings​(java.lang.String[] names,
                             ResolvedType[] types,
                             java.lang.String[] uvars)
    • Method Detail

      • emptyBindings

        public static TypeBindings emptyBindings()
      • create

        public static TypeBindings create​(java.lang.Class<?> erasedType,
                                          java.util.List<ResolvedType> typeList)
        Factory method for constructing bindings for given class using specified type parameters.
      • withUnboundVariable

        public TypeBindings withUnboundVariable​(java.lang.String name)
        Method for creating an instance that has same bindings as this object, plus an indicator for additional type variable that may be unbound within this context; this is needed to resolve recursive self-references.
        Since:
        1.3 (renamed from "withAdditionalBinding" in 1.2)
      • findBoundType

        public ResolvedType findBoundType​(java.lang.String name)
        Find type bound to specified name, if there is one; returns bound type if so, null if not.
      • isEmpty

        public boolean isEmpty()
      • size

        public int size()
        Returns number of bindings contained
      • getBoundName

        public java.lang.String getBoundName​(int index)
      • getBoundType

        public ResolvedType getBoundType​(int index)
      • getTypeParameters

        public java.util.List<ResolvedType> getTypeParameters()
        Accessor for getting bound types in declaration order
      • hasUnbound

        public boolean hasUnbound​(java.lang.String name)
        Since:
        2.3
      • toString

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

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

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • typeParameterArray

        protected ResolvedType[] typeParameterArray()