public class FieldGet extends CallableOperation
Operation from a AccessibleField and
behaves like a getter for the field.AccessibleField| Modifier and Type | Field and Description |
|---|---|
private AccessibleField |
field |
| Constructor and Description |
|---|
FieldGet(AccessibleField field)
FieldGetter sets the public field for the getter statement.
|
| Modifier and Type | Method and Description |
|---|---|
void |
appendCode(Type declaringType,
TypeTuple inputTypes,
Type outputType,
java.util.List<Variable> inputVars,
java.lang.StringBuilder b)
Adds the text for an initialization of a variable from a field to the StringBuilder.
|
boolean |
equals(@Nullable java.lang.Object obj) |
ExecutionOutcome |
execute(java.lang.Object[] statementInput)
Performs computation of getting value of field or capturing thrown exceptions.
|
java.lang.String |
getName()
Returns the name for the operation.
|
int |
hashCode() |
boolean |
isConstantField()
Predicate to indicate whether this object represents a constant field.
|
boolean |
isMessage()
Predicate to indicate whether object represents a method-call-like operation (either static or
instance).
|
boolean |
isStatic()
Predicate to indicate whether object represents a static operation on the declaring class.
|
static TypedOperation |
parse(java.lang.String descr)
Parses a getter for a field from a string.
|
boolean |
satisfies(ReflectionPredicate reflectionPredicate)
Determines whether enclosed
Field satisfies the given predicate. |
java.lang.String |
toParsableString(Type declaringType,
TypeTuple inputTypes,
Type outputType)
Returns string descriptor for field that can be parsed by PublicFieldParser.
|
java.lang.String |
toString() |
getArgumentString, getReflectionObject, getValue, isConstructorCall, isMethodCall, isNonreceivingValue, isUncheckedCastprivate AccessibleField field
public FieldGet(AccessibleField field)
field - the AccessibleField object from which to get valuespublic ExecutionOutcome execute(java.lang.Object[] statementInput)
AccessibleField.getValue(Object) suppresses exceptions that occur because field
is not valid or accessible.execute in class CallableOperationstatementInput - the inputs for statementRandoopBug - if field access throws bug exceptionSequenceExecutionException - if field access has a type exceptionpublic void appendCode(Type declaringType, TypeTuple inputTypes, Type outputType, java.util.List<Variable> inputVars, java.lang.StringBuilder b)
appendCode in class CallableOperationinputVars - the list of variables to be usedb - the StringBuilder that strings are appended todeclaringType - the declaring type for this operationinputTypes - the input types for this operationoutputType - the output type for this operationpublic java.lang.String toParsableString(Type declaringType, TypeTuple inputTypes, Type outputType)
toParsableString in class CallableOperationdeclaringType - the declaring type for this operationinputTypes - the input types for this operationoutputType - the output type for this operationpublic java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String getName()
Operationpublic boolean equals(@Nullable java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic static TypedOperation parse(java.lang.String descr) throws OperationParseException
<get>(
field-descriptor )" where "<get>" is literal ("<" and ">" included),
and field-descriptor is as recognized bydescr - the string containing descriptor of getter for a fieldOperationParseException - if any error in descriptor stringpublic boolean isStatic()
OperationisStatic in interface OperationisStatic in class CallableOperationpublic boolean isConstantField()
OperationisConstantField in interface OperationisConstantField in class CallableOperationpublic boolean isMessage()
isMessage in interface OperationisMessage in class CallableOperationpublic boolean satisfies(ReflectionPredicate reflectionPredicate)
Field satisfies the given predicate.satisfies in interface Operationsatisfies in class CallableOperationreflectionPredicate - the ReflectionPredicate to be checked