Class JavaConstant.MethodType

    • Constructor Detail

      • MethodType

        protected MethodType​(TypeDescription returnType,
                             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

      • of

        public static JavaConstant.MethodType of​(Class<?> returnType,
                                                 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,
                                                 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​(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​(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​(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​(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​(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​(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 String getDescriptor()
        Returns the method descriptor of this method type representation.
        Returns:
        The method descriptor of this method type representation.
      • asConstantPoolValue

        public Object asConstantPoolValue()
        Returns the represented instance as a constant pool value.
        Specified by:
        asConstantPoolValue in interface JavaConstant
        Returns:
        The constant pool value in a format that can be written by ASM.
      • getType

        public TypeDescription getType()
        Returns a description of the type of the represented instance or at least a stub.
        Specified by:
        getType in interface JavaConstant
        Returns:
        A description of the type of the represented instance or at least a stub.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object