Class ClassMethod

    • Field Detail

      • enhancer

        protected ClassEnhancer enhancer
        The parent enhancer.
      • methodName

        protected String methodName
        Name of the method.
      • access

        protected int access
        Access flags for the method (public, protected etc).
      • returnType

        protected Object returnType
        Return type for the method
      • argTypes

        protected Object[] argTypes
        Types of the arguments.
      • argNames

        protected String[] argNames
        Names of the arguments.
      • exceptions

        protected String[] exceptions
        Exceptions that can be thrown.
      • visitor

        protected MethodVisitor visitor
        Visitor for use in updating the method of the class (set in initialise).
    • Constructor Detail

      • ClassMethod

        public ClassMethod​(ClassEnhancer enhancer,
                           String name,
                           int access,
                           Object returnType,
                           Object[] argTypes,
                           String[] argNames)
        Constructor.
        Parameters:
        enhancer - ClassEnhancer
        name - Name of the method
        access - Access for the method (PUBLIC, PROTECTED etc)
        returnType - Return type
        argTypes - Argument type(s)
        argNames - Argument name(s)
      • ClassMethod

        public ClassMethod​(ClassEnhancer enhancer,
                           String name,
                           int access,
                           Object returnType,
                           Object[] argTypes,
                           String[] argNames,
                           String[] exceptions)
        Constructor.
        Parameters:
        enhancer - ClassEnhancer
        name - Name of the method
        access - Access for the method (PUBLIC, PROTECTED etc)
        returnType - Return type
        argTypes - Argument type(s)
        argNames - Argument name(s)
        exceptions - Exceptions that can be thrown
    • Method Detail

      • initialise

        public void initialise()
        Default implementation of initialise, specifying the method based on the ClassMethod info.
      • initialise

        public void initialise​(ClassVisitor classVisitor)
        Method to initialise the class method.
        Parameters:
        classVisitor - Visitor for the class
      • getClassEnhancer

        protected ClassEnhancer getClassEnhancer()
        Convenience accessor for the ClassEnhancer
        Returns:
        ClassEnhancer
      • getDescriptor

        public String getDescriptor()
        Accessor for the descriptor of the method.
        Returns:
        The descriptor
      • getName

        public String getName()
        Accessor for the method name
        Returns:
        Name of the method
      • getAccess

        public int getAccess()
        Accessor for the access
        Returns:
        Access for the method
      • execute

        public abstract void execute()
        Method to add the contents of the class method.
      • close

        public void close()
        Method to close the definition of the class method. This implementation simply logs a debug message to category ENHANCER.
      • hashCode

        public int hashCode()
        Return hash code of this instance.
        Overrides:
        hashCode in class Object
        Returns:
        hash code of this instance
      • equals

        public boolean equals​(Object o)
        Indicates whether some other object is "equal to" this one.
        Overrides:
        equals in class Object
        Parameters:
        o - the reference object with which to compare.
        Returns:
        true if this object is the same as the obj argument; false otherwise.
      • getMethodAdditionMessage

        public static String getMethodAdditionMessage​(String methodName,
                                                      Object returnType,
                                                      Object[] argTypes,
                                                      String[] argNames)
        Convenience method to generate a message that a method has been added.
        Parameters:
        methodName - Name of the method
        returnType - Return type of the method
        argTypes - arg types for the method
        argNames - arg names for the method
        Returns:
        The message