- java.lang.Object
-
- io.leangen.geantyref.CaptureTypeImpl
-
- All Implemented Interfaces:
CaptureType
,java.lang.reflect.Type
class CaptureTypeImpl extends java.lang.Object implements CaptureType
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.reflect.Type[]
lowerBounds
private java.lang.reflect.Type[]
upperBounds
private java.lang.reflect.TypeVariable<?>
variable
private java.lang.reflect.WildcardType
wildcard
-
Constructor Summary
Constructors Constructor Description CaptureTypeImpl(java.lang.reflect.WildcardType wildcard, java.lang.reflect.TypeVariable<?> variable)
Creates an uninitialized CaptureTypeImpl.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.reflect.Type[]
getLowerBounds()
Returns an array of Type objects representing the lower bound(s) of this type variable.java.lang.reflect.TypeVariable<?>
getTypeVariable()
java.lang.reflect.Type[]
getUpperBounds()
Returns an array of Type objects representing the upper bound(s) of this capture.java.lang.reflect.WildcardType
getWildcardType()
(package private) void
init(VarMap varMap)
Initialize this CaptureTypeImpl.void
setUpperBounds(java.lang.reflect.Type[] upperBounds)
Overwrite the upper bounds of this capture.java.lang.String
toString()
-
-
-
Constructor Detail
-
CaptureTypeImpl
CaptureTypeImpl(java.lang.reflect.WildcardType wildcard, java.lang.reflect.TypeVariable<?> variable)
Creates an uninitialized CaptureTypeImpl. Before using this type,init(VarMap)
must be called.- Parameters:
wildcard
- The wildcard this is a capture ofvariable
- The type variable where the wildcard is a parameter for.
-
-
Method Detail
-
init
void init(VarMap varMap)
Initialize this CaptureTypeImpl. This is needed for type variable bounds referring to each other: we need the capture of the argument.
-
getLowerBounds
public java.lang.reflect.Type[] getLowerBounds()
Description copied from interface:CaptureType
Returns an array of Type objects representing the lower bound(s) of this type variable. This is the bound of a ? super wildcard. This normally contains only one or no types; it is an array for consistency withWildcardType.getLowerBounds()
.- Specified by:
getLowerBounds
in interfaceCaptureType
- Returns:
- lower bound(s) of this capture
-
getUpperBounds
public java.lang.reflect.Type[] getUpperBounds()
Description copied from interface:CaptureType
Returns an array of Type objects representing the upper bound(s) of this capture. This includes both the upper bound of a ? extends wildcard, and the bounds declared with the type variable. References to other (or the same) type variables in bounds coming from the type variable are replaced by their matching capture.- Specified by:
getUpperBounds
in interfaceCaptureType
- Returns:
- upper bound(s) of this capture
-
setUpperBounds
public void setUpperBounds(java.lang.reflect.Type[] upperBounds)
Description copied from interface:CaptureType
Overwrite the upper bounds of this capture. Should not normally be used. When transforming a capture type into its annotated version, it might be necessary to set the upper bounds in a separate step to break an otherwise infinite recursion.- Specified by:
setUpperBounds
in interfaceCaptureType
- Parameters:
upperBounds
- upper bound(s) of this capture
-
getTypeVariable
public java.lang.reflect.TypeVariable<?> getTypeVariable()
- Specified by:
getTypeVariable
in interfaceCaptureType
- Returns:
- type variable associated to this capture
-
getWildcardType
public java.lang.reflect.WildcardType getWildcardType()
- Specified by:
getWildcardType
in interfaceCaptureType
- Returns:
- wildcard type associated to this capture
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-