public class GenericClass extends Object implements Serializable
| Constructor and Description |
|---|
GenericClass(Class<?> clazz)
Generate a generic class by setting all generic parameters to their
parameter types
|
GenericClass(GenericClass copy) |
GenericClass(Type type)
Generate a generic class by from a type
|
GenericClass(Type type,
Class<?> clazz)
Generate a GenericClass with this exact generic type and raw class
|
| Modifier and Type | Method and Description |
|---|---|
protected static Type |
addTypeParameters(Class<?> clazz) |
boolean |
canBeInstantiatedTo(GenericClass otherType)
Determine if there exists an instantiation of the type variables such
that the class matches otherType
|
void |
changeClassLoader(ClassLoader loader)
changeClassLoader
|
boolean |
equals(Object obj) |
Class<?> |
getBoxedType() |
String |
getClassName()
getClassName
|
GenericClass |
getComponentClass() |
String |
getComponentName()
getComponentName
|
Type |
getComponentType()
getComponentType
|
Collection<GenericClass> |
getGenericBounds() |
GenericClass |
getGenericInstantiation()
Instantiate all type variables randomly, but adhering to type boundaries
|
GenericClass |
getGenericInstantiation(Map<TypeVariable<?>,Type> typeMap)
Instantiate type variables using map, and anything not contained in the
map randomly
|
List<GenericClass> |
getInterfaces() |
int |
getNumParameters()
Retrieve number of generic type parameters
|
GenericClass |
getOwnerType()
Retrieve the generic owner
|
List<GenericClass> |
getParameterClasses()
Retrieve list of parameter classes
|
List<Type> |
getParameterTypes()
Retrieve list of actual parameters
|
Class<?> |
getRawClass()
getRawClass
|
Type |
getRawComponentClass()
getComponentClass
|
GenericClass |
getRawGenericClass() |
String |
getSimpleName()
getSimpleName
|
GenericClass |
getSuperClass() |
Type |
getType()
Getter for the field
type. |
String |
getTypeName()
getTypeName
|
Map<TypeVariable<?>,Type> |
getTypeVariableMap() |
List<TypeVariable<?>> |
getTypeVariables()
Return a list of type variables of this type, or an empty list if this is
not a parameterized type
|
Class<?> |
getUnboxedType() |
GenericClass |
getWithComponentClass(GenericClass componentClass) |
GenericClass |
getWithGenericParameterTypes(List<GenericClass> parameters) |
GenericClass |
getWithOwnerType(GenericClass ownerClass) |
GenericClass |
getWithParametersFromSuperclass(GenericClass superClass)
If this is a LinkedList> and the super class is a List
|
GenericClass |
getWithParameterTypes(List<Type> parameters) |
GenericClass |
getWithParameterTypes(Type[] parameters) |
GenericClass |
getWithWildcardTypes() |
boolean |
hasGenericSuperType(GenericClass superType)
Determine if this class is a subclass of superType
|
boolean |
hasGenericSuperType(Type superType)
Determine if this class is a subclass of superType
|
int |
hashCode() |
boolean |
hasOwnerType() |
boolean |
hasTypeVariables() |
boolean |
hasWildcardOrTypeVariables() |
boolean |
hasWildcardTypes() |
boolean |
isAbstract()
True if this represents an abstract class
|
boolean |
isAnonymous()
True if this is an anonymous class
|
boolean |
isArray()
Return true if variable is an array
|
static boolean |
isAssignable(Type lhsType,
Type rhsType)
isAssignable
|
boolean |
isAssignableFrom(GenericClass rhsType)
isAssignableFrom
|
boolean |
isAssignableFrom(Type rhsType)
isAssignableFrom
|
boolean |
isAssignableTo(GenericClass lhsType)
isAssignableTo
|
boolean |
isAssignableTo(Type lhsType)
isAssignableTo
|
boolean |
isClass()
True if this represents java.lang.Class
|
boolean |
isEnum()
Return true if variable is an enumeration
|
boolean |
isGenericArray() |
boolean |
isGenericSuperTypeOf(GenericClass subType)
Determine if subType is a generic subclass
|
boolean |
isGenericSuperTypeOf(Type subType)
Determine if subType is a generic subclass
|
boolean |
isObject()
True is this represents java.lang.Object
|
boolean |
isParameterizedType()
True if this represents a parameterized generic type
|
boolean |
isPrimitive()
Return true if variable is a primitive type
|
boolean |
isRawClass()
True if this is a non-generic type
|
boolean |
isString()
True if this represents java.lang.String
|
static boolean |
isSubclass(Type superclass,
Type subclass)
isSubclass
|
boolean |
isTypeVariable()
True if this is a type variable
|
boolean |
isVoid()
Return true if variable is void
|
boolean |
isWildcardType()
True if this is a wildcard type
|
boolean |
isWrapperType()
Return true if type of variable is a primitive wrapper
|
boolean |
satisfiesBoundaries(TypeVariable<?> typeVariable) |
boolean |
satisfiesBoundaries(TypeVariable<?> typeVariable,
Map<TypeVariable<?>,Type> typeMap)
Determine whether the boundaries of the type variable are satisfied by
this class
|
boolean |
satisfiesBoundaries(WildcardType wildcardType) |
boolean |
satisfiesBoundaries(WildcardType wildcardType,
Map<TypeVariable<?>,Type> typeMap)
Determine whether the upper and lower boundaries are satisfied by this
class
|
String |
toString() |
public GenericClass(Class<?> clazz)
clazz - a Class object.public GenericClass(GenericClass copy)
public GenericClass(Type type)
type - a Type object.public boolean canBeInstantiatedTo(GenericClass otherType)
otherType - is the class we want to generatepublic void changeClassLoader(ClassLoader loader)
changeClassLoader
loader - a ClassLoader object.public Class<?> getBoxedType()
public GenericClass getComponentClass()
public Collection<GenericClass> getGenericBounds()
public GenericClass getGenericInstantiation() throws ConstructionFailedException
ConstructionFailedExceptionpublic GenericClass getGenericInstantiation(Map<TypeVariable<?>,Type> typeMap) throws ConstructionFailedException
typeMap - ConstructionFailedExceptionpublic List<GenericClass> getInterfaces()
public int getNumParameters()
public GenericClass getOwnerType()
public List<GenericClass> getParameterClasses()
public GenericClass getRawGenericClass()
public GenericClass getSuperClass()
public Map<TypeVariable<?>,Type> getTypeVariableMap()
public List<TypeVariable<?>> getTypeVariables()
public Class<?> getUnboxedType()
public GenericClass getWithComponentClass(GenericClass componentClass)
public GenericClass getWithGenericParameterTypes(List<GenericClass> parameters)
public GenericClass getWithOwnerType(GenericClass ownerClass)
public GenericClass getWithParametersFromSuperclass(GenericClass superClass) throws ConstructionFailedException
superClass - ConstructionFailedExceptionpublic GenericClass getWithParameterTypes(List<Type> parameters)
public GenericClass getWithParameterTypes(Type[] parameters)
public GenericClass getWithWildcardTypes()
public boolean hasGenericSuperType(GenericClass superType)
superType - public boolean hasGenericSuperType(Type superType)
superType - public boolean hasOwnerType()
public boolean hasTypeVariables()
public boolean hasWildcardOrTypeVariables()
public boolean hasWildcardTypes()
public boolean isAbstract()
public boolean isAnonymous()
public boolean isArray()
public boolean isAssignableFrom(GenericClass rhsType)
isAssignableFrom
rhsType - a GenericClass object.public boolean isAssignableFrom(Type rhsType)
isAssignableFrom
rhsType - a Type object.public boolean isAssignableTo(GenericClass lhsType)
isAssignableTo
lhsType - a GenericClass object.public boolean isAssignableTo(Type lhsType)
isAssignableTo
lhsType - a Type object.public boolean isClass()
public boolean isEnum()
public boolean isGenericArray()
public boolean isGenericSuperTypeOf(GenericClass subType)
subType - public boolean isGenericSuperTypeOf(Type subType)
subType - public boolean isObject()
public boolean isParameterizedType()
public boolean isPrimitive()
public boolean isRawClass()
public boolean isTypeVariable()
public boolean isWildcardType()
public boolean isString()
public boolean isVoid()
public boolean isWrapperType()
public boolean satisfiesBoundaries(TypeVariable<?> typeVariable)
public boolean satisfiesBoundaries(TypeVariable<?> typeVariable, Map<TypeVariable<?>,Type> typeMap)
typeVariable - public boolean satisfiesBoundaries(WildcardType wildcardType)
public boolean satisfiesBoundaries(WildcardType wildcardType, Map<TypeVariable<?>,Type> typeMap)
wildcardType - Copyright © 2010–2017 EvoSuite. All rights reserved.