Class JavaConstant.MethodType
java.lang.Object
net.bytebuddy.utility.JavaConstant.MethodType
- All Implemented Interfaces:
ConstantValue, JavaConstant
- Enclosing interface:
JavaConstant
Represents a
java.lang.invoke.MethodType object.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static interfaceA dispatcher for extracting information from ajava.lang.invoke.MethodTypeinstance.Nested classes/interfaces inherited from interface JavaConstant
JavaConstant.Dynamic, JavaConstant.MethodHandle, JavaConstant.MethodType, JavaConstant.Simple<T>, JavaConstant.Visitor<T> -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedMethodType(TypeDescription returnType, List<? extends TypeDescription> parameterTypes) Creates a method type for the given types. -
Method Summary
Modifier and TypeMethodDescription<T> Taccept(JavaConstant.Visitor<T> visitor) Applies the supplied visitor to this constant type with its respective callback.booleanReturns the method descriptor of this method type representation.Returns the parameter types of this method type.Returns the return type of this method type.Returns a description of the type of this constant.inthashCode()static JavaConstant.MethodTypeReturns a method type description of the given return type and parameter types.static JavaConstant.MethodTypeof(Constructor<?> constructor) Returns a method type description of the given constructor.static JavaConstant.MethodTypeReturns a method type description of the given method.static JavaConstant.MethodTypeof(MethodDescription methodDescription) Returns a method type description of the given method.static JavaConstant.MethodTypeof(TypeDescription returnType, List<? extends TypeDescription> parameterTypes) Returns a method type description of the given return type and parameter types.static JavaConstant.MethodTypeof(TypeDescription returnType, TypeDescription... parameterType) Returns a method type description of the given return type and parameter types.static JavaConstant.MethodTypeResolves an ASMTypeof sortType.METHOD.static JavaConstant.MethodTypeofConstant(Class<?> type) Returns a method type for the given constant type.static JavaConstant.MethodTypeofConstant(Object instance) Returns a method type for the given constant.static JavaConstant.MethodTypeofConstant(TypeDescription typeDescription) Returns a method type for the given constant type.static JavaConstant.MethodTypeReturns a method type for a getter of the given field.static JavaConstant.MethodTypeofGetter(FieldDescription fieldDescription) Returns a method type for a getter of the given field.static JavaConstant.MethodTypeReturns a method type representation of a loadedMethodTypeobject.static JavaConstant.MethodTypeReturns a method type for a setter of the given field.static JavaConstant.MethodTypeofSetter(FieldDescription fieldDescription) Returns a method type for a setter of the given field.static JavaConstant.MethodTypeofSignature(Constructor<?> constructor) Returns a method type description of the given constructor's signature without considering the constructor's actual stack consumption and production.static JavaConstant.MethodTypeofSignature(Method method) Returns a method type description of the given method's signature without considering the method's actual stack consumption and production.static JavaConstant.MethodTypeofSignature(MethodDescription methodDescription) Returns a method type description of the given method's signature without considering the method's actual stack consumption and production.Returns this constant as a Javajava.lang.constant.ConstantDescif the current VM is of at least version 12.Returns a stack manipulation loading this value.toString()
-
Constructor Details
-
MethodType
Creates a method type for the given types.- Parameters:
returnType- The return type of the method type.parameterTypes- The parameter types of the method type.
-
-
Method Details
-
ofAsm
Resolves an ASMTypeof sortType.METHOD.- Parameters:
typePool- The type pool to resolve type descriptions with.methodType- The ASM methodTypeto resolve.- Returns:
- An appropriate
JavaConstant.MethodType.
-
ofLoaded
Returns a method type representation of a loadedMethodTypeobject.- Parameters:
methodType- A method type object to represent as aJavaConstant.- Returns:
- The method type represented as a
JavaConstant.MethodType.
-
of
Returns a method type description of the given return type and parameter types.- Parameters:
returnType- The return type to represent.parameterType- The parameter types to represent.- Returns:
- A method type of the given return type and parameter types.
-
of
public static JavaConstant.MethodType of(TypeDescription returnType, TypeDescription... parameterType) Returns a method type description of the given return type and parameter types.- Parameters:
returnType- The return type to represent.parameterType- The parameter types to represent.- Returns:
- A method type of the given return type and parameter types.
-
of
public static JavaConstant.MethodType of(TypeDescription returnType, List<? extends TypeDescription> parameterTypes) Returns a method type description of the given return type and parameter types.- Parameters:
returnType- The return type to represent.parameterTypes- The parameter types to represent.- Returns:
- A method type of the given return type and parameter types.
-
of
Returns a method type description of the given method.- Parameters:
method- The method to extract the method type from.- Returns:
- The method type of the given method.
-
of
Returns a method type description of the given constructor.- Parameters:
constructor- The constructor to extract the method type from.- Returns:
- The method type of the given constructor.
-
of
Returns a method type description of the given method.- Parameters:
methodDescription- The method to extract the method type from.- Returns:
- The method type of the given method.
-
ofSignature
Returns a method type description of the given method's signature without considering the method's actual stack consumption and production.- Parameters:
method- The method to extract the method type from.- Returns:
- The method type of the given method's signature.
-
ofSignature
Returns a method type description of the given constructor's signature without considering the constructor's actual stack consumption and production.- Parameters:
constructor- The constructor to extract the method type from.- Returns:
- The method type of the given method's signature.
-
ofSignature
Returns a method type description of the given method's signature without considering the method's actual stack consumption and production.- Parameters:
methodDescription- The method to extract the method type from.- Returns:
- The method type of the given method's signature.
-
ofSetter
Returns a method type for a setter of the given field.- Parameters:
field- The field to extract a setter type for.- Returns:
- The type of a setter for the given field.
-
ofSetter
Returns a method type for a setter of the given field.- Parameters:
fieldDescription- The field to extract a setter type for.- Returns:
- The type of a setter for the given field.
-
ofGetter
Returns a method type for a getter of the given field.- Parameters:
field- The field to extract a getter type for.- Returns:
- The type of a getter for the given field.
-
ofGetter
Returns a method type for a getter of the given field.- Parameters:
fieldDescription- The field to extract a getter type for.- Returns:
- The type of a getter for the given field.
-
ofConstant
Returns a method type for the given constant.- Parameters:
instance- The constant for which a constant method type should be created.- Returns:
- A method type for the given constant.
-
ofConstant
Returns a method type for the given constant type.- Parameters:
type- The constant type for which a constant method type should be created.- Returns:
- A method type for the given constant type.
-
ofConstant
Returns a method type for the given constant type.- Parameters:
typeDescription- The constant type for which a constant method type should be created.- Returns:
- A method type for the given constant type.
-
getReturnType
Returns the return type of this method type.- Returns:
- The return type of this method type.
-
getParameterTypes
Returns the parameter types of this method type.- Returns:
- The parameter types of this method type.
-
getDescriptor
Returns the method descriptor of this method type representation.- Returns:
- The method descriptor of this method type representation.
-
toDescription
Returns this constant as a Javajava.lang.constant.ConstantDescif the current VM is of at least version 12. If the current VM is of an older version and does not support the type, an exception is thrown.- Specified by:
toDescriptionin interfaceJavaConstant- Returns:
- This constant as a Java
java.lang.constant.ConstantDesc.
-
accept
Applies the supplied visitor to this constant type with its respective callback.- Specified by:
acceptin interfaceJavaConstant- Type Parameters:
T- The type of the value that is returned by the visitor.- Parameters:
visitor- The visitor to dispatch.- Returns:
- The value that is returned by the supplied visitor.
-
getTypeDescription
Returns a description of the type of this constant.- Specified by:
getTypeDescriptionin interfaceConstantValue- Returns:
- A description of the type of this constant.
-
toStackManipulation
Returns a stack manipulation loading this value.- Specified by:
toStackManipulationin interfaceConstantValue- Returns:
- A stack manipulation loading this value.
-
hashCode
-
equals
-
toString
-