Package com.fasterxml.classmate
Class TypeBindings
- java.lang.Object
-
- com.fasterxml.classmate.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 Summary
Fields Modifier and Type Field Description private int
_hashCode
private java.lang.String[]
_names
Array of type (type variable) names.private ResolvedType[]
_types
Types matching namesprivate java.lang.String[]
_unboundVariables
Names of potentially unresolved type variables.private static TypeBindings
EMPTY
private static java.lang.String[]
NO_STRINGS
private static ResolvedType[]
NO_TYPES
-
Constructor Summary
Constructors Modifier Constructor Description private
TypeBindings(java.lang.String[] names, ResolvedType[] types, java.lang.String[] uvars)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static TypeBindings
create(java.lang.Class<?> erasedType, ResolvedType[] types)
static TypeBindings
create(java.lang.Class<?> erasedType, java.util.List<ResolvedType> typeList)
Factory method for constructing bindings for given class using specified type parameters.static TypeBindings
emptyBindings()
boolean
equals(java.lang.Object o)
ResolvedType
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)
ResolvedType
getBoundType(int index)
java.util.List<ResolvedType>
getTypeParameters()
Accessor for getting bound types in declaration orderint
hashCode()
boolean
hasUnbound(java.lang.String name)
boolean
isEmpty()
int
size()
Returns number of bindings containedjava.lang.String
toString()
protected ResolvedType[]
typeParameterArray()
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.
-
-
-
Field Detail
-
NO_STRINGS
private static final java.lang.String[] NO_STRINGS
-
NO_TYPES
private static final ResolvedType[] NO_TYPES
-
EMPTY
private static final TypeBindings EMPTY
-
_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.
-
create
public static TypeBindings create(java.lang.Class<?> erasedType, ResolvedType[] 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.- 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 classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
typeParameterArray
protected ResolvedType[] typeParameterArray()
-
-