public class TypedClassOperation extends TypedOperation
TypedOperation.RankedTypeOperation
Modifier and Type | Field and Description |
---|---|
private ClassOrInterfaceType |
declaringType
The declaring type for this operation.
|
private @MonotonicNonNull RawSignature |
rawSignature
The cached value of
getRawSignature() . |
compareRankedTypeOperation, inputTypes
Constructor and Description |
---|
TypedClassOperation(CallableOperation operation,
ClassOrInterfaceType declaringType,
TypeTuple inputTypes,
Type outputType)
Creates a
TypedClassOperation for a given CallableOperation indicating the
signature of the operation. |
TypedClassOperation(CallableOperation operation,
ClassOrInterfaceType declaringType,
TypeTuple inputTypes,
Type outputType,
ExecutableSpecification execSpec)
Creates a
TypedClassOperation for a given CallableOperation indicating the
signature of the operation. |
Modifier and Type | Method and Description |
---|---|
void |
appendCode(java.util.List<Variable> inputVars,
java.lang.StringBuilder b)
Produces a Java source code representation of this operation and appends it to the given
StringBuilder.
|
TypedClassOperation |
applyCaptureConversion()
Applies a capture conversion to the wildcard types of this operation, and returns a new
operation with new type variables for the wildcard types.
|
boolean |
equals(@Nullable java.lang.Object obj) |
ClassOrInterfaceType |
getDeclaringType()
Returns the class in which the operation is defined.
|
@Nullable java.lang.String |
getFullyQualifiedSignature()
Returns the fully-qualified signature for this operation if it is a method or constructor call.
|
java.lang.String |
getName()
Returns the name for the operation.
|
TypedClassOperation |
getOperationForType(ClassOrInterfaceType type)
Creates an operation with the same name, input types, and output type as this operation, but
having the given type as the owning class.
|
@Nullable RawSignature |
getRawSignature()
Returns the
RawSignature for this operation if it is a method or constructor call. |
java.util.List<TypeVariable> |
getTypeParameters()
Returns an empty list representing the type parameters of this.
|
java.lang.String |
getUnqualifiedBinaryName()
Returns the simple name of this operation, not qualified by the declaring class.
|
int |
hashCode() |
boolean |
hasWildcardTypes()
Indicates whether this operation has a type that is a wildcard type.
|
TypedClassOperation |
substitute(Substitution substitution)
Applies the given substitution to the generic types in this operation, and returns a new
operation with the instantiated types.
|
java.lang.String |
toParsableString()
Returns a string representation of this Operation, which can be read by the static
parse method for an Operation class. |
java.lang.String |
toString() |
checkPrestate, compareTo, createArrayCreation, createArrayElementAssignment, createCast, createGetterForField, createInitializedArrayCreation, createNonreceiverInitialization, createNullOrZeroInitializationForType, createPrimitiveInitialization, createSetterForField, execute, forConstructor, forMethod, getExecutableSpecification, getInputTypes, getOperation, getOutputType, getSignatureString, getValue, isConstantField, isConstructorCall, isGeneric, isGeneric, isMessage, isMethodCall, isNonreceivingValue, isStatic, isUncheckedCast, satisfies, setExecutableSpecification
private final ClassOrInterfaceType declaringType
private @MonotonicNonNull RawSignature rawSignature
getRawSignature()
.public TypedClassOperation(CallableOperation operation, ClassOrInterfaceType declaringType, TypeTuple inputTypes, Type outputType)
TypedClassOperation
for a given CallableOperation
indicating the
signature of the operation.operation
- the CallableOperation
declaringType
- the declaring class type for this operationinputTypes
- the input types for the operationoutputType
- the output types for the operationpublic TypedClassOperation(CallableOperation operation, ClassOrInterfaceType declaringType, TypeTuple inputTypes, Type outputType, ExecutableSpecification execSpec)
TypedClassOperation
for a given CallableOperation
indicating the
signature of the operation.operation
- the CallableOperation
declaringType
- the declaring class type for this operationinputTypes
- the input types for the operationoutputType
- the output types for the operationexecSpec
- the specification for the operationpublic boolean equals(@Nullable java.lang.Object obj)
equals
in class TypedOperation
public int hashCode()
hashCode
in class TypedOperation
public ClassOrInterfaceType getDeclaringType()
public TypedClassOperation substitute(Substitution substitution)
Applies the substitution to the declaring type, all input types, and the output type.
substitute
in class TypedOperation
substitution
- the substitutionpublic TypedClassOperation applyCaptureConversion()
TypedOperation
applyCaptureConversion
in class TypedOperation
public void appendCode(java.util.List<Variable> inputVars, java.lang.StringBuilder b)
appendCode
in class TypedOperation
inputVars
- the list of variables that are inputs to operationb
- the StringBuilder
to which code is addedpublic java.lang.String toParsableString()
parse
method for an Operation class. For a class C implementing the Operation interface, this
method should return a String s such that parsing the string returns an object equivalent to
this object, i.e., C.parse(this.s).equals(this).toParsableString
in class TypedOperation
Operation
objectpublic java.lang.String toString()
toString
in class TypedOperation
public java.lang.String getName()
Operation
getName
in interface Operation
getName
in class TypedOperation
public java.lang.String getUnqualifiedBinaryName()
public boolean hasWildcardTypes()
TypedOperation
hasWildcardTypes
in class TypedOperation
public java.util.List<TypeVariable> getTypeParameters()
TypedOperation
getTypeParameters
in class TypedOperation
public @Nullable java.lang.String getFullyQualifiedSignature()
public @Nullable RawSignature getRawSignature()
RawSignature
for this operation if it is a method or constructor call.RawSignature
of this method or constructor operation, null if this is
another kind of operationpublic TypedClassOperation getOperationForType(ClassOrInterfaceType type)
Note: this is only a valid object if type
has the method. This is definitely the
case if type
is a subtype of the declaring type of the operation, but this method does
not force that check because we sometimes want to create the operation for superclasses.
type
- a type to substitute into the operationtype
substituted for the declaring type of this operation.
The returned object will be invalid if type
does not have the method. The returned
object may be this
, if the argument is already this
's declaring type.