Package net.bytebuddy.utility
Class JavaConstant.MethodType
- java.lang.Object
-
- net.bytebuddy.utility.JavaConstant.MethodType
-
- All Implemented Interfaces:
JavaConstant
- Enclosing interface:
- JavaConstant
public static class JavaConstant.MethodType extends java.lang.Object implements JavaConstant
Represents ajava.lang.invoke.MethodTypeobject.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static interfaceJavaConstant.MethodType.DispatcherA dispatcher for extracting information from ajava.lang.invoke.MethodTypeinstance.-
Nested classes/interfaces inherited from interface net.bytebuddy.utility.JavaConstant
JavaConstant.MethodHandle, JavaConstant.MethodType
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedMethodType(TypeDescription returnType, java.util.List<? extends TypeDescription> parameterTypes)Creates a method type for the given types.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.ObjectasConstantPoolValue()Returns the represented instance as a constant pool value.StackManipulationasStackManipulation()Returns the instance as loadable onto the operand stack.booleanequals(java.lang.Object other)java.lang.StringgetDescriptor()Returns the method descriptor of this method type representation.TypeListgetParameterTypes()Returns the parameter types of this method type.TypeDescriptiongetReturnType()Returns the return type of this method type.TypeDescriptiongetType()Returns a description of the type of the represented instance or at least a stub.inthashCode()static JavaConstant.MethodTypeof(java.lang.Class<?> returnType, java.lang.Class<?>... parameterType)Returns a method type description of the given return type and parameter types.static JavaConstant.MethodTypeof(java.lang.reflect.Constructor<?> constructor)Returns a method type description of the given constructor.static JavaConstant.MethodTypeof(java.lang.reflect.Method method)Returns 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, java.util.List<? extends TypeDescription> parameterTypes)Returns a method type description of the given return type and parameter types.static JavaConstant.MethodTypeofConstant(java.lang.Class<?> type)Returns a method type for the given constant type.static JavaConstant.MethodTypeofConstant(java.lang.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.MethodTypeofGetter(java.lang.reflect.Field field)Returns 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.MethodTypeofLoaded(java.lang.Object methodType)Returns a method type representation of a loadedMethodTypeobject.static JavaConstant.MethodTypeofSetter(java.lang.reflect.Field field)Returns 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.
-
-
-
Constructor Detail
-
MethodType
protected MethodType(TypeDescription returnType, java.util.List<? extends TypeDescription> parameterTypes)
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 Detail
-
ofLoaded
public static JavaConstant.MethodType ofLoaded(java.lang.Object methodType)
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
public static JavaConstant.MethodType of(java.lang.Class<?> returnType, java.lang.Class<?>... 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, java.util.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
public static JavaConstant.MethodType of(java.lang.reflect.Method method)
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
public static JavaConstant.MethodType of(java.lang.reflect.Constructor<?> constructor)
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
public static JavaConstant.MethodType of(MethodDescription methodDescription)
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.
-
ofSetter
public static JavaConstant.MethodType ofSetter(java.lang.reflect.Field field)
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
public static JavaConstant.MethodType ofSetter(FieldDescription fieldDescription)
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
public static JavaConstant.MethodType ofGetter(java.lang.reflect.Field field)
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
public static JavaConstant.MethodType ofGetter(FieldDescription fieldDescription)
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
public static JavaConstant.MethodType ofConstant(java.lang.Object instance)
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
public static JavaConstant.MethodType ofConstant(java.lang.Class<?> type)
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
public static JavaConstant.MethodType ofConstant(TypeDescription typeDescription)
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
public TypeDescription getReturnType()
Returns the return type of this method type.- Returns:
- The return type of this method type.
-
getParameterTypes
public TypeList getParameterTypes()
Returns the parameter types of this method type.- Returns:
- The parameter types of this method type.
-
getDescriptor
public java.lang.String getDescriptor()
Returns the method descriptor of this method type representation.- Returns:
- The method descriptor of this method type representation.
-
asConstantPoolValue
public java.lang.Object asConstantPoolValue()
Description copied from interface:JavaConstantReturns the represented instance as a constant pool value.- Specified by:
asConstantPoolValuein interfaceJavaConstant- Returns:
- The constant pool value in a format that can be written by ASM.
-
asStackManipulation
public StackManipulation asStackManipulation()
Description copied from interface:JavaConstantReturns the instance as loadable onto the operand stack.- Specified by:
asStackManipulationin interfaceJavaConstant- Returns:
- A stack manipulation that loads the represented value onto the operand stack.
-
getType
public TypeDescription getType()
Description copied from interface:JavaConstantReturns a description of the type of the represented instance or at least a stub.- Specified by:
getTypein interfaceJavaConstant- Returns:
- A description of the type of the represented instance or at least a stub.
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-