public interface MethodDescription extends TypeVariableSource, ModifierReviewable.ForMethodDescription, DeclaredByType.WithMandatoryDeclaration, ByteCodeElement.Member, ByteCodeElement.TypeDependant<MethodDescription.InDefinedShape,MethodDescription.Token>
equal(Object) and hashCode() implementations.| Modifier and Type | Interface and Description |
|---|---|
static class |
MethodDescription.AbstractBase
An abstract base implementation of a method description.
|
static class |
MethodDescription.ForLoadedConstructor
An implementation of a method description for a loaded constructor.
|
static class |
MethodDescription.ForLoadedMethod
An implementation of a method description for a loaded method.
|
static interface |
MethodDescription.InDefinedShape
Represents a method in its defined shape, i.e.
|
static interface |
MethodDescription.InGenericShape
Represents a method description in its generic shape, i.e.
|
static class |
MethodDescription.Latent
A latent method description describes a method that is not attached to a declaring
TypeDescription. |
static class |
MethodDescription.SignatureToken
A token representing a method's name and raw return and parameter types.
|
static class |
MethodDescription.Token
A token representing a method's properties detached from a type.
|
static class |
MethodDescription.TypeSubstituting
A method description that represents a given method but with substituted method types.
|
static class |
MethodDescription.TypeToken
A token representing a method's erased return and parameter types.
|
TypeVariableSource.Visitor<T>ByteCodeElement.Member, ByteCodeElement.TypeDependant<T extends ByteCodeElement.TypeDependant<?,S>,S extends ByteCodeElement.Token<S>>ModifierReviewable.ForFieldDescription, ModifierReviewable.ForMethodDescription, ModifierReviewable.ForParameterDescription, ModifierReviewable.ForTypeDefinition, ModifierReviewable.OfAbstraction, ModifierReviewable.OfByteCodeElement, ModifierReviewable.OfEnumerationDeclaredByType.WithMandatoryDeclarationAnnotationSource.Empty, AnnotationSource.ExplicitNamedElement.WithDescriptor, NamedElement.WithGenericName, NamedElement.WithOptionalName, NamedElement.WithRuntimeName| Modifier and Type | Field and Description |
|---|---|
static String |
CONSTRUCTOR_INTERNAL_NAME
The internal name of a Java constructor.
|
static String |
TYPE_INITIALIZER_INTERNAL_NAME
The internal name of a Java static initializer.
|
static int |
TYPE_INITIALIZER_MODIFIER
The type initializer of any representation of a type initializer.
|
static MethodDescription.InDefinedShape |
UNDEFINED
Represents any undefined property of a type description that is instead represented as
null in order
to resemble the Java reflection API which returns null and is intuitive to many Java developers. |
NON_GENERIC_SIGNATUREEMPTY_MASKEMPTY_NAME, NO_NAME| Modifier and Type | Method and Description |
|---|---|
MethodDescription.SignatureToken |
asSignatureToken()
Returns a signature token representing this method.
|
MethodDescription.TypeToken |
asTypeToken()
Returns a type token that represents this method's raw return and parameter types.
|
int |
getActualModifiers()
Returns this method's actual modifiers as it is present in a class file, i.e.
|
int |
getActualModifiers(boolean manifest)
Returns this method's actual modifiers as it is present in a class file, i.e.
|
int |
getActualModifiers(boolean manifest,
Visibility visibility)
Returns this method's actual modifiers as it is present in a class file, i.e.
|
AnnotationValue<?,?> |
getDefaultValue()
Returns the method's default annotation value or
null if no default value is defined for this method. |
<T> T |
getDefaultValue(Class<T> type)
Returns the default value but casts it to the given type.
|
TypeList.Generic |
getExceptionTypes()
Returns the exception types of the described method.
|
ParameterList<?> |
getParameters()
Returns a list of this method's parameters.
|
TypeDescription.Generic |
getReceiverType()
Returns this methods receiver type.
|
TypeDescription.Generic |
getReturnType()
Returns the return type of the described method.
|
int |
getStackSize()
Returns the size of the local variable array that is required for this method, i.e.
|
boolean |
isBridgeCompatible(MethodDescription.TypeToken typeToken)
Validates that the supplied type token can implement a bridge method to this method.
|
boolean |
isConstantBootstrap()
Checks if this method is a valid bootstrap method for an constantdynamic call.
|
boolean |
isConstantBootstrap(List<? extends TypeDefinition> arguments)
Checks if this method is a valid bootstrap method for a constantdynamic call.
|
boolean |
isConstructor()
Checks if this method description represents a constructor.
|
boolean |
isDefaultMethod()
Checks if this method represents a default (defender) method.
|
boolean |
isDefaultValue()
Checks if this method is capable of defining a default annotation value.
|
boolean |
isDefaultValue(AnnotationValue<?,?> annotationValue)
Checks if the given value can describe a default annotation value for this method.
|
boolean |
isInvokableOn(TypeDescription typeDescription)
Asserts if this method is invokable on an instance of the given type, i.e.
|
boolean |
isInvokeBootstrap()
Checks if this method is a valid bootstrap method for an invokedynamic call.
|
boolean |
isInvokeBootstrap(List<? extends TypeDefinition> arguments)
Checks if this method is a valid bootstrap method for an invokedynamic call.
|
boolean |
isMethod()
Checks if this method description represents a method, i.e.
|
boolean |
isSpecializableFor(TypeDescription typeDescription)
Checks if this method can be called using the
INVOKESPECIAL for a given type. |
boolean |
isTypeInitializer()
Checks if this method is a type initializer.
|
boolean |
isVirtual()
Verifies if this method describes a virtual method, i.e.
|
boolean |
represents(Constructor<?> constructor)
Verifies if a method description represents a given loaded constructor.
|
boolean |
represents(Method method)
Verifies if a method description represents a given loaded method.
|
accept, findExpectedVariable, findVariable, getEnclosingSource, getTypeVariables, isGenerified, isInferrablegetMethodManifestation, getMethodStrictness, getSynchronizationState, isBridge, isNative, isStrict, isSynchronized, isVarArgsisAbstractgetDeclaringTypeisAccessibleTo, isVisibleTogetDescriptor, getGenericSignaturegetOwnership, getVisibility, isDeprecated, isPackagePrivate, isPrivate, isProtected, isPublic, isStaticgetModifiers, getSyntheticState, isFinal, isSyntheticgetDeclaredAnnotationstoGenericStringgetInternalName, getNamegetActualNameasDefined, asTokenstatic final String CONSTRUCTOR_INTERNAL_NAME
static final String TYPE_INITIALIZER_INTERNAL_NAME
static final int TYPE_INITIALIZER_MODIFIER
@AlwaysNull static final MethodDescription.InDefinedShape UNDEFINED
null in order
to resemble the Java reflection API which returns null and is intuitive to many Java developers.TypeDescription.Generic getReturnType()
ParameterList<?> getParameters()
TypeList.Generic getExceptionTypes()
int getActualModifiers()
Deprecated.int getActualModifiers(boolean manifest)
Deprecated and adjusts the modifiers for being abstract or not.manifest - true if the method should be treated as non-abstract.int getActualModifiers(boolean manifest,
Visibility visibility)
Deprecated and adjusts the modifiers for being abstract or not. Additionally, this method
resolves a required minimal visibility.manifest - true if the method should be treated as non-abstract.visibility - The minimal visibility to enforce for this method.boolean isConstructor()
true if this method description represents a constructor.boolean isMethod()
true if this method description represents a Java method.boolean isTypeInitializer()
true if this method description represents a type initializer.boolean represents(Method method)
method - The method to be checked.true if this method description represents the given loaded method.boolean represents(Constructor<?> constructor)
constructor - The constructor to be checked.true if this method description represents the given loaded constructor.boolean isVirtual()
true if this method is virtual.int getStackSize()
this if this method represented a non-static
method.boolean isDefaultMethod()
true if this method is a default method.boolean isSpecializableFor(TypeDescription typeDescription)
INVOKESPECIAL for a given type.typeDescription - The type otrue if this method can be called using the INVOKESPECIAL instruction
using the given type.@MaybeNull AnnotationValue<?,?> getDefaultValue()
null if no default value is defined for this method.null if no default value is defined for this method.@MaybeNull <T> T getDefaultValue(Class<T> type)
ClassCastException is thrown.T - The type to cast the default value to.type - The type to cast the default value to.boolean isInvokableOn(TypeDescription typeDescription)
typeDescription - The type to check.true if this method is invokable on an instance of the given type.boolean isInvokeBootstrap()
true if this method is a valid bootstrap method for an invokedynamic call.boolean isInvokeBootstrap(List<? extends TypeDefinition> arguments)
arguments - The types of the explicit arguments that are supplied to the bootstrap method.true if this method is a valid bootstrap method for an invokedynamic call.boolean isConstantBootstrap()
true if this method is a valid bootstrap method for an constantdynamic call.boolean isConstantBootstrap(List<? extends TypeDefinition> arguments)
arguments - The types of the explicit arguments that are supplied to the bootstrap method.true if this method is a valid bootstrap method for an constantdynamic call.boolean isDefaultValue()
true if it is possible to define a default annotation value for this method.boolean isDefaultValue(AnnotationValue<?,?> annotationValue)
annotationValue - The value that describes the default annotation value for this method.true if the given value can describe a default annotation value for this method.@MaybeNull TypeDescription.Generic getReceiverType()
static methods
where null is returned. Other than a receiver type that is provided by the Java reflection
API, Byte Buddy is capable of extracting annotations on type parameters of receiver types when
directly accessing a class file. Therefore, a receiver type might be parameterized.MethodDescription.SignatureToken asSignatureToken()
MethodDescription.TypeToken asTypeToken()
boolean isBridgeCompatible(MethodDescription.TypeToken typeToken)
typeToken - A type token representing a potential bridge method to this method.true if the supplied type token can represent a bridge method to this method.Copyright © 2014–2023. All rights reserved.