class TypeExtractor extends DefaultClassVisitor
TypeExtractor is a ClassVisitor that extracts both the class type, and concrete
types that are used in a class as either a parameter, a return type, or a field type.| Modifier and Type | Field and Description |
|---|---|
private java.util.Set<Type> |
inputTypes
The set of concrete types.
|
private AccessibilityPredicate |
predicate
The accessibility predicate for checking whether a type is accessible in generated tests.
|
| Constructor and Description |
|---|
TypeExtractor(java.util.Set<Type> inputTypes,
AccessibilityPredicate predicate)
Creates a visitor that adds discovered concrete types to the given set if they satisfy the
accessibility predicate.
|
| Modifier and Type | Method and Description |
|---|---|
private void |
addIfConcrete(Type type)
Determines whether the given general type is not generic, and, if so, adds the concrete type to
the input types of this object.
|
void |
visit(java.lang.Class<?> c,
ReflectionManager reflectionManager)
Perform action on member class.
|
void |
visit(java.lang.reflect.Constructor<?> c)
Perform action on a constructor.
|
void |
visit(java.lang.reflect.Field f)
Perform an action on a field.
|
void |
visit(java.lang.reflect.Method m)
Perform an action on a method.
|
void |
visitBefore(java.lang.Class<?> c)
Perform an action on a class.
|
toString, visit, visitAfterprivate java.util.Set<Type> inputTypes
private final AccessibilityPredicate predicate
TypeExtractor(java.util.Set<Type> inputTypes, AccessibilityPredicate predicate)
inputTypes - the set of concrete typespredicate - the accessibility predicatepublic void visit(java.lang.Class<?> c,
ReflectionManager reflectionManager)
ClassVisitorThe ReflectionManager is needed to allow visitors to initiate recursive visits if
needed.
visit in interface ClassVisitorvisit in class DefaultClassVisitorc - the member classreflectionManager - the ReflectionManager that called this visitorpublic void visit(java.lang.reflect.Constructor<?> c)
Adds all concrete parameter types from the constructor to the input types set of this object.
visit in interface ClassVisitorvisit in class DefaultClassVisitorc - the constructorpublic void visit(java.lang.reflect.Method m)
Adds any concrete type among parameter and return types to the input types set of this object. Avoids bridge methods, because may have rawtypes not useful in building tests.
visit in interface ClassVisitorvisit in class DefaultClassVisitorm - the methodpublic void visit(java.lang.reflect.Field f)
Adds a concrete field type to the input types set of this object.
visit in interface ClassVisitorvisit in class DefaultClassVisitorf - the fieldprivate void addIfConcrete(Type type)
type - the general typepublic void visitBefore(java.lang.Class<?> c)
Adds the class if it is concrete.
visitBefore in interface ClassVisitorvisitBefore in class DefaultClassVisitorc - the class to visit