Top Description Inners Fields Methods
net.bytebuddy.description.method

public Interface MethodDescription

extends TypeVariableSource, ForMethodDescription, WithMandatoryDeclaration, Member, ByteCodeElement.TypeDependant<MethodDescription.InDefinedShape, MethodDescription.Token>
Known Direct Subinterfaces
net.bytebuddy.description.method.MethodDescription.InGenericShape, net.bytebuddy.description.method.MethodDescription.InDefinedShape
Known Direct Implementers
net.bytebuddy.description.method.MethodDescription.AbstractBase
Imports
edu.umd.cs.findbugs.annotations.SuppressFBWarnings, net.bytebuddy.build.AccessControllerPlugin, .CachedReturnPlugin, net.bytebuddy.description.ByteCodeElement, .DeclaredByType, .ModifierReviewable, .TypeVariableSource, net.bytebuddy.description.annotation.AnnotationDescription, .AnnotationList, .AnnotationValue, net.bytebuddy.description.enumeration.EnumerationDescription, net.bytebuddy.description.modifier.ModifierContributor, .Visibility, net.bytebuddy.description.type.TypeDefinition, .TypeDescription, .TypeList, .TypeVariableToken, net.bytebuddy.matcher.ElementMatcher, .ElementMatchers, net.bytebuddy.utility.JavaType, net.bytebuddy.utility.dispatcher.JavaDispatcher, net.bytebuddy.utility.nullability.AlwaysNull, .MaybeNull, net.bytebuddy.jar.asm.Opcodes, .Type, net.bytebuddy.jar.asm.signature.SignatureWriter, javax.annotation.Nonnull, java.lang.annotation.Annotation, java.lang.reflect.*, java.security.PrivilegedAction, java.util.*

Implementations of this interface describe a Java method, i.e. a method or a constructor. Implementations of this interface must provide meaningful equal(Object) and hashCode() implementations.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public abstract static class
MethodDescription.AbstractBase

An abstract base implementation of a method description.

public static class
MethodDescription.ForLoadedConstructor

An implementation of a method description for a loaded constructor.

public static class
MethodDescription.ForLoadedMethod

An implementation of a method description for a loaded method.

public static interface
MethodDescription.InDefinedShape

Represents a method in its defined shape, i.e. in the form it is defined by a class without its type variables being resolved.

public static interface
MethodDescription.InGenericShape

Represents a method description in its generic shape, i.e. in the shape it is defined by a generic or raw type.

public static class
MethodDescription.Latent

A latent method description describes a method that is not attached to a declaring TypeDescription.

public static class
MethodDescription.SignatureToken

A token representing a method's name and raw return and parameter types.

public static class
MethodDescription.Token

A token representing a method's properties detached from a type.

public static class
MethodDescription.TypeSubstituting

A method description that represents a given method but with substituted method types.

public static class
MethodDescription.TypeToken

A token representing a method's erased return and parameter types.

Field Summary

Modifier and TypeField and Description
public static final String
CONSTRUCTOR_INTERNAL_NAME

The internal name of a Java constructor.

public static final String
TYPE_INITIALIZER_INTERNAL_NAME

The internal name of a Java static initializer.

public static final int
TYPE_INITIALIZER_MODIFIER

The type initializer of any representation of a type initializer.

public static final MethodDescription.InDefinedShape
UNDEFINED

Hides net.bytebuddy.description.TypeVariableSource.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.

Method Summary

Modifier and TypeMethod and Description
public MethodDescription.SignatureToken

Returns:

A signature token representing this method.
asSignatureToken
()

Returns a signature token representing this method.

public MethodDescription.TypeToken

Returns:

A type token that represents this method's raw return and parameter types.
asTypeToken
()

Returns a type token that represents this method's raw return and parameter types.

public int

Returns:

The method's actual modifiers.
getActualModifiers
()

Returns this method's actual modifiers as it is present in a class file, i.e. includes a flag if this method is marked Deprecated.

public int

Returns:

The method's actual modifiers.
getActualModifiers
(boolean
true if the method should be treated as non-abstract.
manifest
)

Returns this method's actual modifiers as it is present in a class file, i.e. includes a flag if this method is marked Deprecated and adjusts the modifiers for being abstract or not.

public int

Returns:

The method's actual modifiers.
getActualModifiers
(boolean
true if the method should be treated as non-abstract.
manifest
,
Visibility
The minimal visibility to enforce for this method.
visibility
)

Returns this method's actual modifiers as it is present in a class file, i.e. includes a flag if this method is marked Deprecated and adjusts the modifiers for being abstract or not.

public TypeDefinition
public AnnotationValue<?, ?>

Returns:

The method's default annotation value or null if no default value is defined for this method.
getDefaultValue
()

Returns the method's default annotation value or null if no default value is defined for this method.

public <
The type to cast the default value to.
T
>
T

Returns:

The casted default value.
getDefaultValue
(Class<T>
The type to cast the default value to.
type
)

Returns the default value but casts it to the given type.

public TypeList.Generic

Returns:

The exception types of the described method.
getExceptionTypes
()

Returns the exception types of the described method.

public ParameterList<?>

Returns:

A list of this method's parameters.
getParameters
()

Returns a list of this method's parameters.

public TypeDescription.Generic

Returns:

This method's (annotated) receiver type.
getReceiverType
()

Returns this methods receiver type.

public TypeDescription.Generic

Returns:

The return type of the described method.
getReturnType
()

Returns the return type of the described method.

public int

Returns:

The size of this method on the operand stack.
getStackSize
()

Returns the size of the local variable array that is required for this method, i.e. the size of all parameters if they were loaded on the stack including a reference to this if this method represented a non-static method.

public boolean

Returns:

true if the supplied type token can represent a bridge method to this method.
isBridgeCompatible
(MethodDescription.TypeToken
A type token representing a potential bridge method to this method.
typeToken
)

Validates that the supplied type token can implement a bridge method to this method.

public boolean

Returns:

true if this method is a valid bootstrap method for an constantdynamic call.
isConstantBootstrap
()

Checks if this method is a valid bootstrap method for an constantdynamic call.

public boolean

Returns:

true if this method is a valid bootstrap method for an constantdynamic call.
isConstantBootstrap
(List<? extends TypeDefinition>
The types of the explicit arguments that are supplied to the bootstrap method.
arguments
)

Checks if this method is a valid bootstrap method for a constantdynamic call.

public boolean

Returns:

true if this method description represents a constructor.
isConstructor
()

Checks if this method description represents a constructor.

public boolean

Returns:

true if this method is a default method.
isDefaultMethod
()

Checks if this method represents a default (defender) method.

public boolean

Returns:

true if it is possible to define a default annotation value for this method.
isDefaultValue
()

Checks if this method is capable of defining a default annotation value.

public boolean

Returns:

true if the given value can describe a default annotation value for this method.
isDefaultValue
(AnnotationValue<?, ?>
The value that describes the default annotation value for this method.
annotationValue
)

Checks if the given value can describe a default annotation value for this method.

public boolean

Returns:

true if this method is invokable on an instance of the given type.
isInvokableOn
(TypeDescription
The type to check.
typeDescription
)

Asserts if this method is invokable on an instance of the given type, i.e. the method is an instance method or a constructor and the method is visible to the type and can be invoked on the given instance.

public boolean

Returns:

true if this method is a valid bootstrap method for an invokedynamic call.
isInvokeBootstrap
()

Checks if this method is a valid bootstrap method for an invokedynamic call.

public boolean

Returns:

true if this method is a valid bootstrap method for an invokedynamic call.
isInvokeBootstrap
(List<? extends TypeDefinition>
The types of the explicit arguments that are supplied to the bootstrap method.
arguments
)

Checks if this method is a valid bootstrap method for an invokedynamic call.

public boolean

Returns:

true if this method description represents a Java method.
isMethod
()

Checks if this method description represents a method, i.e. not a constructor or a type initializer.

public boolean

Returns:

true if this method can be called using the INVOKESPECIAL instruction using the given type.
isSpecializableFor
(TypeDescription
The type o
typeDescription
)

Checks if this method can be called using the INVOKESPECIAL for a given type.

public boolean

Returns:

true if this method description represents a type initializer.
isTypeInitializer
()

Checks if this method is a type initializer.

public boolean

Returns:

true if this method is virtual.
isVirtual
()

Verifies if this method describes a virtual method, i.e. a method that is inherited by a sub type of this type.

public boolean

Returns:

true if this method description represents the given loaded method.
represents
(Method
The method to be checked.
method
)

Verifies if a method description represents a given loaded method.

public boolean

Returns:

true if this method description represents the given loaded constructor.
represents
(Constructor<?>
The constructor to be checked.
constructor
)

Verifies if a method description represents a given loaded constructor.

Inherited from net.bytebuddy.description.ByteCodeElement.TypeDependant:
asDefinedasToken
Inherited from net.bytebuddy.description.ModifierReviewable.ForMethodDescription:
getMethodManifestationgetMethodStrictnessgetSynchronizationStateisBridgeisNativeisStrictisSynchronizedisVarArgs
Inherited from net.bytebuddy.description.TypeVariableSource:
acceptfindExpectedVariablefindVariablegetEnclosingSourcegetTypeVariablesisGenerifiedisInferrable