Class GenericMetadataSupport.TypeVarBoundedType
- java.lang.Object
-
- org.mockito.internal.util.reflection.GenericMetadataSupport.TypeVarBoundedType
-
- All Implemented Interfaces:
java.lang.reflect.Type
,GenericMetadataSupport.BoundedType
- Enclosing class:
- GenericMetadataSupport
public static class GenericMetadataSupport.TypeVarBoundedType extends java.lang.Object implements GenericMetadataSupport.BoundedType
Type representing bounds of a type variable, allows to keep all bounds information.It uses the first bound in the array, as this array is never null and always contains at least one element (Object is always here if no bounds are declared).
If upper bounds are declared with SomeClass and additional interfaces, then firstBound will be SomeClass and interfacesBound will be an array of the additional interfaces.
i.e.
SomeClass
.interface UpperBoundedTypeWithClass
& Cloneable> { E get(); } // will return Comparable type
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.reflect.TypeVariable<?>
typeVariable
-
Constructor Summary
Constructors Constructor Description TypeVarBoundedType(java.lang.reflect.TypeVariable<?> typeVariable)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
java.lang.reflect.Type
firstBound()
int
hashCode()
java.lang.reflect.Type[]
interfaceBounds()
On a Type Variable (typeVar extends C_0 & I_1 & I_2 & etc), will return an array containing I_1 and I_2.java.lang.String
toString()
java.lang.reflect.TypeVariable<?>
typeVariable()
-
-
-
Method Detail
-
firstBound
public java.lang.reflect.Type firstBound()
- Specified by:
firstBound
in interfaceGenericMetadataSupport.BoundedType
- Returns:
- either a class or an interface (parameterized or not), if no bounds declared Object is returned.
-
interfaceBounds
public java.lang.reflect.Type[] interfaceBounds()
On a Type Variable (typeVar extends C_0 & I_1 & I_2 & etc), will return an array containing I_1 and I_2.- Specified by:
interfaceBounds
in interfaceGenericMetadataSupport.BoundedType
- Returns:
- other bounds for this type, these bounds can only be only interfaces as the JLS says, empty array if no other bound declared.
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
typeVariable
public java.lang.reflect.TypeVariable<?> typeVariable()
-
-