public final class ConstructorCall extends CallableOperation
| Modifier and Type | Field and Description |
|---|---|
private java.lang.reflect.Constructor<?> |
constructor |
private int |
hashCodeCached |
private boolean |
hashCodeComputed |
| Constructor and Description |
|---|
ConstructorCall(java.lang.reflect.Constructor<?> constructor)
Creates object corresponding to the given reflection constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
appendCode(Type declaringType,
TypeTuple inputTypes,
Type outputType,
java.util.List<Variable> inputVars,
java.lang.StringBuilder b)
Adds code for a constructor call to the given
StringBuilder. |
boolean |
equals(@Nullable java.lang.Object o)
Tests whether the parameter is a call to the same constructor.
|
ExecutionOutcome |
execute(java.lang.Object[] statementInput)
Performs this operation using the array of input values.
|
java.lang.reflect.Constructor<?> |
getConstructor()
Return the reflective constructor corresponding to this ConstructorCall.
|
java.lang.String |
getName()
Returns the name for the operation.
|
java.lang.reflect.Constructor<?> |
getReflectionObject() |
int |
hashCode()
Returns the hashCode for the constructor called by this object.
|
boolean |
isConstructorCall()
Predicate to indicate whether object represents a call to a constructor.
|
static TypedClassOperation |
parse(java.lang.String signature)
Parse a constructor call in a string with the format generated by
toParsableString(Type, TypeTuple, Type) and returns the corresponding ConstructorCall object. |
boolean |
satisfies(ReflectionPredicate reflectionPredicate)
Checks whether reflective object contained in an
Operation satisfies the predicate. |
java.lang.String |
toParsableString(Type declaringType,
TypeTuple inputTypes,
Type outputType)
Returns a string representation of this Operation (not an invocation of this Operation), which
can be read by the static parse method for the class in which the method is defined.
|
java.lang.String |
toString()
Returns concise string representation of this ConstructorCall.
|
getArgumentString, getValue, isConstantField, isMessage, isMethodCall, isNonreceivingValue, isStatic, isUncheckedCastprivate final java.lang.reflect.Constructor<?> constructor
private int hashCodeCached
private boolean hashCodeComputed
public ConstructorCall(java.lang.reflect.Constructor<?> constructor)
constructor - reflective object for a constructorpublic java.lang.reflect.Constructor<?> getConstructor()
Constructor object called by this constructor callpublic java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String getName()
Operationpublic void appendCode(Type declaringType, TypeTuple inputTypes, Type outputType, java.util.List<Variable> inputVars, java.lang.StringBuilder b)
StringBuilder.appendCode in class CallableOperationinputVars - a list of variables representing the actual arguments for the constructor callb - the StringBuilder to which the output is appendeddeclaringType - the declaring type for this operationinputTypes - the input types for this operationoutputType - the output type for this operationTypedClassOperation.appendCode(List, StringBuilder)public boolean equals(@Nullable java.lang.Object o)
equals in class java.lang.Objecto - an objectpublic int hashCode()
hashCode in class java.lang.Objectpublic ExecutionOutcome execute(java.lang.Object[] statementInput)
Performs call to the constructor given the objects as actual parameters, and the output stream for any output.
execute in class CallableOperationstatementInput - is an array of values corresponding to signature of the constructorTypedOperation.execute(Object[])public java.lang.String toParsableString(Type declaringType, TypeTuple inputTypes, Type outputType)
Generates a string representation of the constructor signature.
Examples:
java.util.ArrayList.<init>()
java.util.ArrayList.<init>(java.util.Collection)
toParsableString in class CallableOperationdeclaringType - the declaring type for this operationinputTypes - the input types for this operationoutputType - the output type for this operationparse(String)public static TypedClassOperation parse(java.lang.String signature) throws OperationParseException
toParsableString(Type, TypeTuple, Type) and returns the corresponding ConstructorCall object.signature - a string descriptor of a constructor callOperationParseException - if no constructor found for signatureOperationParser.parse(String)public boolean isConstructorCall()
isConstructorCall in interface OperationisConstructorCall in class CallableOperationConstructorCallpublic java.lang.reflect.Constructor<?> getReflectionObject()
getReflectionObject in class CallableOperationpublic boolean satisfies(ReflectionPredicate reflectionPredicate)
Operation satisfies the predicate.
Since there is no reflective object in an CallableOperation, returns false.
Determines whether enclosed Constructor satisfies the given predicate.
satisfies in interface Operationsatisfies in class CallableOperationreflectionPredicate - ReflectionPredicate against which object to be checkedReflectionPredicate.test(Constructor) implemented by predicate.