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 |
---|---|
protected static class |
MethodConstant.CachedConstructor
Represents a cached constructor for a
MethodConstant . |
protected static class |
MethodConstant.CachedMethod
Represents a cached method for a
MethodConstant . |
static interface |
MethodConstant.CanCache
Represents a
MethodConstant that is
directly loaded onto the operand stack without caching the value. |
protected static class |
MethodConstant.CanCacheIllegal
Represents a method constant that cannot be represented by Java's reflection API.
|
protected static class |
MethodConstant.ForConstructor
Creates a
MethodConstant for loading
a Constructor instance onto the operand stack. |
protected static class |
MethodConstant.ForMethod
Creates a
MethodConstant for loading
a Method instance onto the operand stack. |
protected static class |
MethodConstant.PrivilegedLookup
Performs a privileged lookup of a method constant by using an
AccessController . |
StackManipulation.Compound, StackManipulation.Illegal, StackManipulation.Size, StackManipulation.Trivial
Modifier and Type | Field and Description |
---|---|
protected MethodDescription.InDefinedShape |
methodDescription
A description of the method to be loaded onto the stack.
|
Modifier | Constructor and Description |
---|---|
protected |
MethodConstant(MethodDescription.InDefinedShape methodDescription)
Creates a new method constant.
|
Modifier and Type | Method and Description |
---|---|
protected abstract MethodDescription.InDefinedShape |
accessorMethod()
Returns the method for loading a declared method or constructor onto the operand stack.
|
StackManipulation.Size |
apply(org.objectweb.asm.MethodVisitor methodVisitor,
Implementation.Context implementationContext)
Applies the stack manipulation that is described by this instance.
|
boolean |
equals(Object other) |
int |
hashCode() |
boolean |
isValid()
Determines if this stack manipulation is valid.
|
protected abstract StackManipulation |
methodName()
Returns a stack manipulation that loads the method name onto the operand stack if this is required.
|
static MethodConstant.CanCache |
of(MethodDescription.InDefinedShape methodDescription)
Creates a stack manipulation that loads a method constant onto the operand stack.
|
static MethodConstant.CanCache |
ofPrivileged(MethodDescription.InDefinedShape methodDescription)
Creates a stack manipulation that loads a method constant onto the operand stack using an
AccessController . |
protected MethodConstant.CanCache |
privileged()
Returns a method constant that uses an
AccessController to look up this constant. |
protected static List<StackManipulation> |
typeConstantsFor(List<TypeDescription> parameterTypes)
Returns a list of type constant load operations for the given list of parameters.
|
protected final MethodDescription.InDefinedShape methodDescription
protected MethodConstant(MethodDescription.InDefinedShape methodDescription)
methodDescription
- The method description for which the Method
representation
should be created.public static MethodConstant.CanCache of(MethodDescription.InDefinedShape methodDescription)
methodDescription
- The method to be loaded onto the stack.public static MethodConstant.CanCache ofPrivileged(MethodDescription.InDefinedShape methodDescription)
AccessController
.methodDescription
- The method to be loaded onto the stack.protected static List<StackManipulation> typeConstantsFor(List<TypeDescription> parameterTypes)
parameterTypes
- A list of all type descriptions that should be represented as type constant
load operations.public boolean isValid()
isValid
in interface StackManipulation
false
, this manipulation cannot be applied and should throw an exception.public StackManipulation.Size apply(org.objectweb.asm.MethodVisitor methodVisitor, Implementation.Context implementationContext)
apply
in interface StackManipulation
methodVisitor
- The method visitor used to write the method implementation to.implementationContext
- The context of the current implementation.protected MethodConstant.CanCache privileged()
AccessController
to look up this constant.AccessController
to look up this constant.protected abstract StackManipulation methodName()
protected abstract MethodDescription.InDefinedShape accessorMethod()
Copyright © 2014–2021. All rights reserved.