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 java.lang.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
Fields Modifier and Type Field Description private java.util.List<? extends AnnotationDescription>annotationsThe annotations of the represented method.private AnnotationValue<?,?>defaultValueThe default value of the represented method ornullif no such value exists.private java.util.List<? extends TypeDescription.Generic>exceptionTypesThe exception types of the represented method.private intmodifiersThe modifiers of the represented method.private java.lang.StringnameThe internal name of the represented method.private java.util.List<? extends ParameterDescription.Token>parameterTokensThe parameter tokens of the represented method.private TypeDescription.GenericreceiverTypeThe receiver type of the represented method ornullif the receiver type is implicit.private TypeDescription.GenericreturnTypeThe return type of the represented method.private java.util.List<? extends TypeVariableToken>typeVariableTokensA list of tokens representing the method's type variables.
-
Constructor Summary
Constructors Constructor Description Token(int modifiers)Creates a new method token representing a constructor without any parameters, exception types, type variables or annotations.Token(java.lang.String name, int modifiers, java.util.List<? extends TypeVariableToken> typeVariableTokens, TypeDescription.Generic returnType, java.util.List<? extends ParameterDescription.Token> parameterTokens, java.util.List<? extends TypeDescription.Generic> exceptionTypes, java.util.List<? extends AnnotationDescription> annotations, AnnotationValue<?,?> defaultValue, TypeDescription.Generic receiverType)Creates a new token for a method description.Token(java.lang.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(java.lang.String name, int modifiers, TypeDescription.Generic returnType, java.util.List<? extends TypeDescription.Generic> parameterTypes)Creates a new method token with simple values.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MethodDescription.Tokenaccept(TypeDescription.Generic.Visitor<? extends TypeDescription.Generic> visitor)Transforms the types represented by this token by applying the given visitor to them.MethodDescription.SignatureTokenasSignatureToken(TypeDescription declaringType)Creates a signature token that represents the method that is represented by this token.booleanequals(java.lang.Object other)AnnotationListgetAnnotations()Returns the annotations of the represented method.AnnotationValue<?,?>getDefaultValue()Returns the default value of the represented method.TypeList.GenericgetExceptionTypes()Returns the exception types of the represented method.intgetModifiers()Returns the modifiers of the represented method.java.lang.StringgetName()Returns the internal name of the represented method.ByteCodeElement.Token.TokenList<ParameterDescription.Token>getParameterTokens()Returns the parameter tokens of the represented method.TypeDescription.GenericgetReceiverType()Returns the receiver type of this token ornullif the receiver type is implicit.TypeDescription.GenericgetReturnType()Returns the return type of the represented method.ByteCodeElement.Token.TokenList<TypeVariableToken>getTypeVariableTokens()Returns the type variables of this method token.inthashCode()java.lang.StringtoString()
-
-
-
Field Detail
-
name
private final java.lang.String name
The internal name of the represented method.
-
modifiers
private final int modifiers
The modifiers of the represented method.
-
typeVariableTokens
private final java.util.List<? extends TypeVariableToken> typeVariableTokens
A list of tokens representing the method's type variables.
-
returnType
private final TypeDescription.Generic returnType
The return type of the represented method.
-
parameterTokens
private final java.util.List<? extends ParameterDescription.Token> parameterTokens
The parameter tokens of the represented method.
-
exceptionTypes
private final java.util.List<? extends TypeDescription.Generic> exceptionTypes
The exception types of the represented method.
-
annotations
private final java.util.List<? extends AnnotationDescription> annotations
The annotations of the represented method.
-
defaultValue
@MaybeNull private final AnnotationValue<?,?> defaultValue
The default value of the represented method ornullif no such value exists.
-
receiverType
@MaybeNull private final TypeDescription.Generic receiverType
The receiver type of the represented method ornullif the receiver type is implicit.
-
-
Constructor Detail
-
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
public Token(java.lang.String name, int modifiers, TypeDescription.Generic returnType)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(java.lang.String name, int modifiers, TypeDescription.Generic returnType, java.util.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(java.lang.String name, int modifiers, java.util.List<? extends TypeVariableToken> typeVariableTokens, TypeDescription.Generic returnType, java.util.List<? extends ParameterDescription.Token> parameterTokens, java.util.List<? extends TypeDescription.Generic> exceptionTypes, java.util.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 ornullif no such value exists.receiverType- The receiver type of the represented method ornullif the receiver type is implicit.
-
-
Method Detail
-
getName
public java.lang.String 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
public ByteCodeElement.Token.TokenList<TypeVariableToken> getTypeVariableTokens()
Returns the type variables of this method token.- Returns:
- A a list of tokens representing the method's type variables.
-
getReturnType
public TypeDescription.Generic getReturnType()
Returns the return type of the represented method.- Returns:
- The return type of the represented method.
-
getParameterTokens
public ByteCodeElement.Token.TokenList<ParameterDescription.Token> getParameterTokens()
Returns the parameter tokens of the represented method.- Returns:
- The parameter tokens of the represented method.
-
getExceptionTypes
public TypeList.Generic getExceptionTypes()
Returns the exception types of the represented method.- Returns:
- The exception types of the represented method.
-
getAnnotations
public AnnotationList getAnnotations()
Returns the annotations of the represented method.- Returns:
- The annotations of the represented method.
-
getDefaultValue
@MaybeNull public AnnotationValue<?,?> getDefaultValue()
Returns the default value of the represented method.- Returns:
- The default value of the represented method or
nullif no such value exists.
-
getReceiverType
@MaybeNull public TypeDescription.Generic getReceiverType()
Returns the receiver type of this token ornullif the receiver type is implicit.- Returns:
- The receiver type of this token or
nullif 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:
acceptin 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
public MethodDescription.SignatureToken asSignatureToken(TypeDescription declaringType)
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
@Enhance("hashCode") public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(@MaybeNull java.lang.Object other)
- Overrides:
equalsin classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-