public abstract class MethodConstant extends Object implements StackManipulation
Method
value which can be created from a given
set of constant pool values and can therefore be considered a constant in the broader meaning.Modifier and Type | Class and Description |
---|---|
static interface |
MethodConstant.CanCache
Represents a
MethodConstant that is
directly loaded onto the operand stack without caching the value. |
StackManipulation.Compound, StackManipulation.Illegal, StackManipulation.LegalTrivial, StackManipulation.Size
Modifier and Type | Field and Description |
---|---|
protected MethodDescription |
methodDescription
A description of the method to be loaded onto the stack.
|
Modifier | Constructor and Description |
---|---|
protected |
MethodConstant(MethodDescription methodDescription)
Creates a new method constant.
|
Modifier and Type | Method and Description |
---|---|
StackManipulation.Size |
apply(org.objectweb.asm.MethodVisitor methodVisitor,
Instrumentation.Context instrumentationContext)
Applies the stack manipulation that is described by this instance.
|
StackManipulation |
cached()
Returns a cached version of this method constant as specified by
MethodConstant.Cached . |
boolean |
equals(Object other) |
static MethodConstant.CanCache |
forMethod(MethodDescription methodDescription)
Creates a stack manipulation that loads a method constant onto the operand stack.
|
protected abstract String |
getDescriptor()
Returns the descriptor of the
Class method for creating this method constant. |
protected abstract String |
getMethodName()
Returns the name of the
Class method for creating this method constant. |
int |
hashCode() |
boolean |
isValid()
Determines if this stack manipulation is valid.
|
protected abstract StackManipulation.Size |
prepare(org.objectweb.asm.MethodVisitor methodVisitor)
Applies all preparation to the given method visitor.
|
String |
toString() |
protected final MethodDescription methodDescription
protected MethodConstant(MethodDescription methodDescription)
methodDescription
- The method description for which the Method
representation
should be created.public static MethodConstant.CanCache forMethod(MethodDescription methodDescription)
methodDescription
- The method to be loaded onto the stack.public boolean isValid()
StackManipulation
isValid
in interface StackManipulation
false
, this manipulation cannot be applied and should throw an exception.public StackManipulation.Size apply(org.objectweb.asm.MethodVisitor methodVisitor, Instrumentation.Context instrumentationContext)
StackManipulation
apply
in interface StackManipulation
methodVisitor
- The method visitor used to write the method implementation to.instrumentationContext
- The context of the current instrumentation.protected abstract StackManipulation.Size prepare(org.objectweb.asm.MethodVisitor methodVisitor)
methodVisitor
- The method visitor to which the preparation is applied.protected abstract String getMethodName()
Class
method for creating this method constant.protected abstract String getDescriptor()
Class
method for creating this method constant.public StackManipulation cached()
MethodConstant.Cached
.Copyright © 2014. All rights reserved.