Package randoop.types
Class ParameterizedType
- java.lang.Object
-
- randoop.types.Type
-
- randoop.types.ReferenceType
-
- randoop.types.ClassOrInterfaceType
-
- randoop.types.ParameterizedType
-
- All Implemented Interfaces:
Comparable<Type>
- Direct Known Subclasses:
GenericClassType
,InstantiatedType
public abstract class ParameterizedType extends ClassOrInterfaceType
Represents a parameterized type. A parameterized type is a typeC<T1,...,Tk>
whereC<F1,...,Fk>
is a generic class instantiated by a substitution[Fi:=Ti]
, andTi
is a subtype of the upper boundBi
of the type parameterFi
.- See Also:
GenericClassType
,InstantiatedType
-
-
Field Summary
Fields Modifier and Type Field Description private static Map<Class<?>,GenericClassType>
cache
A cache of all ParameterizedTypes that have been created.-
Fields inherited from class randoop.types.ClassOrInterfaceType
enclosingType
-
-
Constructor Summary
Constructors Constructor Description ParameterizedType()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static GenericClassType
forClass(Class<?> typeClass)
Creates aGenericClassType
for the given reflectiveClass
object.static ParameterizedType
forType(Type type)
Performs the conversion ofjava.lang.reflect.ParameterizedType
to aParameterizedType
.String
getBinaryName()
Returns the binary name of this type, including type arguments if this is a parameterized type (so, it isn't really a binary name).String
getFqName()
Returns the fully-qualified name of this type, including type arguments if this is a parameterized type.abstract GenericClassType
getGenericClassType()
Returns theGenericClassType
for this parameterized type.String
getUnqualifiedBinaryName()
Returns the name of this type without package name, but with type arguments if parameterized, and enclosing class if a member class.abstract ParameterizedType
substitute(Substitution substitution)
Applies a substitution to aReferenceType
.-
Methods inherited from class randoop.types.ClassOrInterfaceType
applyCaptureConversion, applyCaptureConversion, equals, getAllSupertypesInclusive, getCanonicalName, getImmediateSupertypes, getInstantiatingSubstitution, getInterfaces, getMatchingSupertype, getPackage, getPackagePrefix, getRawtype, getSimpleName, getSuperclass, getSuperTypes, getTypeArguments, getTypeParameters, hasCaptureVariable, hashCode, hasWildcard, isAbstract, isClassOrInterfaceType, isGeneric, isInstantiationOf, isMemberClass, isNestedClass, isParameterized, isStatic, isSubtypeOf, substitute
-
Methods inherited from class randoop.types.ReferenceType
getInstantiatingSubstitutionforTypeVariable, isAssignableFrom, isCaptureVariable, isReferenceType
-
Methods inherited from class randoop.types.Type
compareTo, forFullyQualifiedName, forName, forValue, getRuntimeClass, getTypeforFullyQualifiedName, isArray, isAssignableFromTypeOf, isBoxedPrimitive, isClass, isEnum, isGeneric, isInterface, isNonreceiverType, isObject, isPrimitive, isRawtype, isString, isVariable, isVoid, runtimeClassIs, toString
-
-
-
-
Field Detail
-
cache
private static final Map<Class<?>,GenericClassType> cache
A cache of all ParameterizedTypes that have been created.
-
-
Method Detail
-
forClass
public static GenericClassType forClass(Class<?> typeClass)
Creates aGenericClassType
for the given reflectiveClass
object.- Parameters:
typeClass
- the class type- Returns:
- a generic class type for the given type
-
forType
public static ParameterizedType forType(Type type)
Performs the conversion ofjava.lang.reflect.ParameterizedType
to aParameterizedType
.- Parameters:
type
- the reflective type object- Returns:
- an object of type
ParameterizedType
-
substitute
public abstract ParameterizedType substitute(Substitution substitution)
Description copied from class:ClassOrInterfaceType
Applies a substitution to aReferenceType
. If the type is parameterized then replaces type variables that occur, otherwise returns this type.This abstract method forces typing of substitutions applied to
ReferenceType
objects without an explicit cast.This abstract method allows substitutions to be applied to
ClassOrInterfaceType
objects without casting.- Specified by:
substitute
in classClassOrInterfaceType
- Parameters:
substitution
- the type substitution- Returns:
- the type created by applying the substitution to this type
-
getGenericClassType
public abstract GenericClassType getGenericClassType()
Returns theGenericClassType
for this parameterized type.- Returns:
- the generic class type for this type
-
getFqName
public String getFqName()
Description copied from class:Type
Returns the fully-qualified name of this type, including type arguments if this is a parameterized type. Forjava.util.List<T>
return"java.util.List<T>"
.- Overrides:
getFqName
in classClassOrInterfaceType
- Returns:
- the fully-qualified type name for this type
-
getBinaryName
public String getBinaryName()
Description copied from class:Type
Returns the binary name of this type, including type arguments if this is a parameterized type (so, it isn't really a binary name). Forjava.util.List<T>
return"java.util.List<T>"
.- Overrides:
getBinaryName
in classClassOrInterfaceType
- Returns:
- the binary name for this type
-
getUnqualifiedBinaryName
public String getUnqualifiedBinaryName()
Description copied from class:Type
Returns the name of this type without package name, but with type arguments if parameterized, and enclosing class if a member class. For instance, forjava.util.List<T>
would return"List<T>"
.- Overrides:
getUnqualifiedBinaryName
in classClassOrInterfaceType
- Returns:
- the unqualified name of this type
-
-