Package net.bytebuddy.description.method
Class MethodDescription.Token
java.lang.Object
net.bytebuddy.description.method.MethodDescription.Token
- All Implemented Interfaces:
ByteCodeElement.Token<MethodDescription.Token>
- Enclosing interface:
MethodDescription
public static class MethodDescription.Token
extends Object
implements ByteCodeElement.Token<MethodDescription.Token>
A token representing a method's properties detached from a type.
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.bytebuddy.description.ByteCodeElement.Token
ByteCodeElement.Token.TokenList<S extends ByteCodeElement.Token<S>>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final List
<? extends AnnotationDescription> The annotations of the represented method.private final AnnotationValue
<?, ?> The default value of the represented method ornull
if no such value exists.private final List
<? extends TypeDescription.Generic> The exception types of the represented method.private final int
The modifiers of the represented method.private final String
The internal name of the represented method.private final List
<? extends ParameterDescription.Token> The parameter tokens of the represented method.private final TypeDescription.Generic
The receiver type of the represented method ornull
if the receiver type is implicit.private final TypeDescription.Generic
The return type of the represented method.private final List
<? extends TypeVariableToken> A list of tokens representing the method's type variables. -
Constructor Summary
ConstructorsConstructorDescriptionToken
(int modifiers) Creates a new method token representing a constructor without any parameters, exception types, type variables or annotations.Token
(String name, int modifiers, List<? extends TypeVariableToken> typeVariableTokens, TypeDescription.Generic returnType, List<? extends ParameterDescription.Token> parameterTokens, List<? extends TypeDescription.Generic> exceptionTypes, List<? extends AnnotationDescription> annotations, AnnotationValue<?, ?> defaultValue, TypeDescription.Generic receiverType) Creates a new token for a method description.Token
(String name, int modifiers, TypeDescription.Generic returnType) Creates a new method token representing a method without any parameters, exception types, type variables or annotations.Token
(String name, int modifiers, TypeDescription.Generic returnType, List<? extends TypeDescription.Generic> parameterTypes) Creates a new method token with simple values. -
Method Summary
Modifier and TypeMethodDescriptionaccept
(TypeDescription.Generic.Visitor<? extends TypeDescription.Generic> visitor) Transforms the types represented by this token by applying the given visitor to them.asSignatureToken
(TypeDescription declaringType) Creates a signature token that represents the method that is represented by this token.boolean
Returns the annotations of the represented method.AnnotationValue
<?, ?> Returns the default value of the represented method.Returns the exception types of the represented method.int
Returns the modifiers of the represented method.getName()
Returns the internal name of the represented method.Returns the parameter tokens of the represented method.Returns the receiver type of this token ornull
if the receiver type is implicit.Returns the return type of the represented method.Returns the type variables of this method token.int
hashCode()
toString()
-
Field Details
-
name
The internal name of the represented method. -
modifiers
private final int modifiersThe modifiers of the represented method. -
typeVariableTokens
A list of tokens representing the method's type variables. -
returnType
The return type of the represented method. -
parameterTokens
The parameter tokens of the represented method. -
exceptionTypes
The exception types of the represented method. -
annotations
The annotations of the represented method. -
defaultValue
The default value of the represented method ornull
if no such value exists. -
receiverType
The receiver type of the represented method ornull
if the receiver type is implicit.
-
-
Constructor Details
-
Token
public Token(int modifiers) Creates a new method token representing a constructor without any parameters, exception types, type variables or annotations. All types must be represented in an detached format.- Parameters:
modifiers
- The constructor's modifiers.
-
Token
Creates a new method token representing a method without any parameters, exception types, type variables or annotations. All types must be represented in an detached format.- Parameters:
name
- The name of the method.modifiers
- The modifiers of the method.returnType
- The return type of the method.
-
Token
public Token(String name, int modifiers, TypeDescription.Generic returnType, List<? extends TypeDescription.Generic> parameterTypes) Creates a new method token with simple values. All types must be represented in an detached format.- Parameters:
name
- The internal name of the represented method.modifiers
- The modifiers of the represented method.returnType
- The return type of the represented method.parameterTypes
- The parameter types of this method.
-
Token
public Token(String name, int modifiers, List<? extends TypeVariableToken> typeVariableTokens, TypeDescription.Generic returnType, List<? extends ParameterDescription.Token> parameterTokens, List<? extends TypeDescription.Generic> exceptionTypes, List<? extends AnnotationDescription> annotations, @MaybeNull AnnotationValue<?, ?> defaultValue, @MaybeNull TypeDescription.Generic receiverType) Creates a new token for a method description. All types must be represented in an detached format.- Parameters:
name
- The internal name of the represented method.modifiers
- The modifiers of the represented method.typeVariableTokens
- The type variables of the the represented method.returnType
- The return type of the represented method.parameterTokens
- The parameter tokens of the represented method.exceptionTypes
- The exception types of the represented method.annotations
- The annotations of the represented method.defaultValue
- The default value of the represented method ornull
if no such value exists.receiverType
- The receiver type of the represented method ornull
if the receiver type is implicit.
-
-
Method Details
-
getName
Returns the internal name of the represented method.- Returns:
- The internal name of the represented method.
-
getModifiers
public int getModifiers()Returns the modifiers of the represented method.- Returns:
- The modifiers of the represented method.
-
getTypeVariableTokens
Returns the type variables of this method token.- Returns:
- A a list of tokens representing the method's type variables.
-
getReturnType
Returns the return type of the represented method.- Returns:
- The return type of the represented method.
-
getParameterTokens
Returns the parameter tokens of the represented method.- Returns:
- The parameter tokens of the represented method.
-
getExceptionTypes
Returns the exception types of the represented method.- Returns:
- The exception types of the represented method.
-
getAnnotations
Returns the annotations of the represented method.- Returns:
- The annotations of the represented method.
-
getDefaultValue
Returns the default value of the represented method.- Returns:
- The default value of the represented method or
null
if no such value exists.
-
getReceiverType
Returns the receiver type of this token ornull
if the receiver type is implicit.- Returns:
- The receiver type of this token or
null
if the receiver type is implicit.
-
accept
public MethodDescription.Token accept(TypeDescription.Generic.Visitor<? extends TypeDescription.Generic> visitor) Transforms the types represented by this token by applying the given visitor to them.- Specified by:
accept
in interfaceByteCodeElement.Token<MethodDescription.Token>
- Parameters:
visitor
- The visitor to transform all types that are represented by this token.- Returns:
- This token with all of its represented types transformed by the supplied visitor.
-
asSignatureToken
Creates a signature token that represents the method that is represented by this token.- Parameters:
declaringType
- The declaring type of the method that this token represents.- Returns:
- A signature token representing this token.
-
hashCode
-
equals
-
toString
-