Class TypeBindings

  • All Implemented Interfaces:
    java.io.Serializable

    public class TypeBindings
    extends java.lang.Object
    implements java.io.Serializable
    Helper class used for resolving type parameters for given class
    See Also:
    Serialized Form
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object asKey​(java.lang.Class<?> rawBase)
      Factory method that will create an object that can be used as a key for caching purposes by TypeFactory
      static TypeBindings create​(java.lang.Class<?> erasedType, JavaType typeArg1)  
      static TypeBindings create​(java.lang.Class<?> erasedType, JavaType[] types)  
      static TypeBindings create​(java.lang.Class<?> erasedType, JavaType typeArg1, JavaType typeArg2)  
      static TypeBindings create​(java.lang.Class<?> erasedType, java.util.List<JavaType> typeList)
      Factory method for constructing bindings for given class using specified type parameters.
      static TypeBindings create​(java.util.List<java.lang.String> names, java.util.List<JavaType> types)
      Factory method for constructing bindings given names and associated types.
      static TypeBindings createIfNeeded​(java.lang.Class<?> erasedType, JavaType typeArg1)
      Alternate factory method that may be called if it is possible that type does or does not require type parameters; this is mostly useful for collection- and map-like types.
      static TypeBindings createIfNeeded​(java.lang.Class<?> erasedType, JavaType[] types)
      Alternate factory method that may be called if it is possible that type does or does not require type parameters; this is mostly useful for collection- and map-like types.
      static TypeBindings emptyBindings()  
      boolean equals​(java.lang.Object o)  
      JavaType findBoundType​(java.lang.String name)
      Find type bound to specified name, if there is one; returns bound type if so, null if not.
      java.lang.String getBoundName​(int index)  
      JavaType getBoundType​(int index)  
      java.util.List<JavaType> getTypeParameters()
      Accessor for getting bound types in declaration order
      int hashCode()  
      boolean hasUnbound​(java.lang.String name)  
      boolean isEmpty()  
      int size()
      Returns number of bindings contained
      java.lang.String toString()  
      TypeBindings withoutVariable​(java.lang.String name)
      Create a new instance with the same bindings as this object, except with the given variable removed.
      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.
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Method Detail

      • emptyBindings

        public static TypeBindings emptyBindings()
      • create

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

        public static TypeBindings create​(java.util.List<java.lang.String> names,
                                          java.util.List<JavaType> types)
        Factory method for constructing bindings given names and associated types.
      • createIfNeeded

        public static TypeBindings createIfNeeded​(java.lang.Class<?> erasedType,
                                                  JavaType typeArg1)
        Alternate factory method that may be called if it is possible that type does or does not require type parameters; this is mostly useful for collection- and map-like types.
      • createIfNeeded

        public static TypeBindings createIfNeeded​(java.lang.Class<?> erasedType,
                                                  JavaType[] types)
        Alternate factory method that may be called if it is possible that type does or does not require type parameters; this is mostly useful for collection- and map-like types.
      • 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.
      • withoutVariable

        public TypeBindings withoutVariable​(java.lang.String name)
        Create a new instance with the same bindings as this object, except with the given variable removed. This is used to create generic types that are "partially raw", i.e. only have some variables bound.
        Since:
        2.16
      • findBoundType

        public JavaType 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 JavaType getBoundType​(int index)
      • getTypeParameters

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

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

        public java.lang.Object asKey​(java.lang.Class<?> rawBase)
        Factory method that will create an object that can be used as a key for caching purposes by TypeFactory
        Returns:
        An object which can be used as a key in TypeFactory, or null if no key can be created.
        Since:
        2.8
      • 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