Package randoop.types
Class ParameterType
- java.lang.Object
-
- randoop.types.Type
-
- randoop.types.ReferenceType
-
- randoop.types.ParameterType
-
- All Implemented Interfaces:
Comparable<Type>
- Direct Known Subclasses:
TypeVariable
,WildcardType
public abstract class ParameterType extends ReferenceType
An abstract class representing kinds of type parameters, which are either type variables or wildcard types. Manages both upper and lower type bounds.
-
-
Field Summary
Fields Modifier and Type Field Description private ParameterBound
lowerBound
The lower bound on this type.private ParameterBound
upperBound
The upper bound on this type.
-
Constructor Summary
Constructors Constructor Description ParameterType()
ParameterType(ParameterBound lowerBound, ParameterBound upperBound)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object object)
String
getCanonicalName()
Returns the name of this type as the "canonical name" of the underlying runtime class.ParameterBound
getLowerTypeBound()
Class<?>
getRuntimeClass()
Returns the runtimeClass
object for this type.List<TypeVariable>
getTypeParameters()
Returns the list of type parameters for this type.ParameterBound
getUpperTypeBound()
boolean
hasCaptureVariable()
Indicates whether thisReferenceType
has a capture variable.boolean
hasGenericBound()
Return true if this has a generic bound.int
hashCode()
boolean
hasWildcard()
Indicates whether this type has a wildcard anywhere within it.(package private) void
setLowerBound(ParameterBound lowerBound)
(package private) void
setUpperBound(ParameterBound upperBound)
String
toString()
-
Methods inherited from class randoop.types.ReferenceType
applyCaptureConversion, forClass, forType, getInstantiatingSubstitution, getInstantiatingSubstitutionforTypeVariable, isAssignableFrom, isCaptureVariable, isInstantiationOf, isReferenceType, isSubtypeOf, substitute
-
Methods inherited from class randoop.types.Type
compareTo, forFullyQualifiedName, forName, forValue, getBinaryName, getFqName, getRawtype, getSimpleName, getTypeforFullyQualifiedName, getUnqualifiedBinaryName, isArray, isAssignableFromTypeOf, isBoxedPrimitive, isClass, isClassOrInterfaceType, isEnum, isGeneric, isGeneric, isInterface, isNonreceiverType, isObject, isParameterized, isPrimitive, isRawtype, isString, isVariable, isVoid, runtimeClassIs
-
-
-
-
Field Detail
-
lowerBound
private ParameterBound lowerBound
The lower bound on this type.
-
upperBound
private ParameterBound upperBound
The upper bound on this type.
-
-
Constructor Detail
-
ParameterType
ParameterType()
-
ParameterType
ParameterType(ParameterBound lowerBound, ParameterBound upperBound)
-
-
Method Detail
-
getCanonicalName
public String getCanonicalName()
Description copied from class:Type
Returns the name of this type as the "canonical name" of the underlying runtime class. Identical toType.getFqName()
except for types with type arguments. Forjava.util.List<T>
returns"java.util.List"
. Returnsnull
whenClass<?>.getCanonicalName()
does for the underlyingClass<?>
object (e.g., the type is a local or anonymous class, or array type where the component type that has no canonical name).- Overrides:
getCanonicalName
in classType
- Returns:
- the fully-qualified canonical name of this type
-
getLowerTypeBound
public ParameterBound getLowerTypeBound()
-
getUpperTypeBound
public ParameterBound getUpperTypeBound()
-
getTypeParameters
public List<TypeVariable> getTypeParameters()
Description copied from class:ReferenceType
Returns the list of type parameters for this type. Reference types that may have type parameters includeArrayType
(such asE[]
), and subclasses ofParameterizedType
.- Overrides:
getTypeParameters
in classReferenceType
- Returns:
- the type parameters for this type
-
getRuntimeClass
public Class<?> getRuntimeClass()
Returns the runtimeClass
object for this type. For use when reflection is needed.Note that type variables and the null reference type do not have a runtime class, and this method will return null in those cases.
This method should not be confused with the inherited
Object.getClass()
method, which returns theClass<?>
for theType
object, and not of the represented type. For instance, if aType
objectt
represented the Java typeint
, thent.getRuntimeClass()
would returnint.class
whilet.getClass()
would returnType.class
.- Specified by:
getRuntimeClass
in classType
- Returns:
- null since type variables do not have a runtime class
-
setUpperBound
void setUpperBound(ParameterBound upperBound)
-
setLowerBound
void setLowerBound(ParameterBound lowerBound)
-
hasWildcard
public boolean hasWildcard()
Description copied from class:Type
Indicates whether this type has a wildcard anywhere within it.- Overrides:
hasWildcard
in classType
- Returns:
- true if this type has a wildcard, false otherwise
-
hasCaptureVariable
public boolean hasCaptureVariable()
Description copied from class:Type
Indicates whether thisReferenceType
has a capture variable.- Overrides:
hasCaptureVariable
in classType
- Returns:
- true iff this type has a capture variable
-
hasGenericBound
public boolean hasGenericBound()
Return true if this has a generic bound.- Returns:
- true if this has a generic bound
-
-