Package randoop.reflection
Class TestValueExtractor
- java.lang.Object
-
- randoop.reflection.DefaultClassVisitor
-
- randoop.reflection.TestValueExtractor
-
- All Implemented Interfaces:
ClassVisitor
public class TestValueExtractor extends DefaultClassVisitor
TestValueExtractor
is aClassVisitor
that inspects the fields passed to it to see if they are annotated withTestValue
, are static, and have type that is primitive, String, or an array of primitive or String.
-
-
Field Summary
Fields Modifier and Type Field Description private Set<Sequence>
valueSequences
-
Constructor Summary
Constructors Constructor Description TestValueExtractor(Set<Sequence> valueSequences)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private List<Object>
getValue(Field f)
Returns the value stored in the given (static) field with primitive, String or array of primitive or String type.private static void
printDetectedAnnotatedFieldMsg(Field f)
Prints an informational message that an annotated field has been found.void
visit(Field f)
Perform an action on a field.-
Methods inherited from class randoop.reflection.DefaultClassVisitor
toString, visit, visit, visit, visit, visitAfter, visitBefore
-
-
-
-
Method Detail
-
visit
public void visit(Field f)
Perform an action on a field.If the field is static and is annotated with
randoop.TestValue
, adds the value of the field to the sequence set constructed by this visitor. Requires that the field type be primitive, String, or an array of primitive or String type.- Specified by:
visit
in interfaceClassVisitor
- Overrides:
visit
in classDefaultClassVisitor
- Parameters:
f
- the field
-
getValue
private List<Object> getValue(Field f)
Returns the value stored in the given (static) field with primitive, String or array of primitive or String type.- Parameters:
f
- the field- Returns:
- the value(s) in the field
-
printDetectedAnnotatedFieldMsg
private static void printDetectedAnnotatedFieldMsg(Field f)
Prints an informational message that an annotated field has been found.- Parameters:
f
- the field
-
-