Class BindingMethod

  • Direct Known Subclasses:
    ExistingMethod, MethodBuilder

    public abstract class BindingMethod
    extends Object
    Binding method information. Tracks a method used by the binding code, supplying hash code and equality checking based on the method signature and actual byte code of the method, ignoring the method name. This allows comparisons between methods generated by different bindings, and between generated and existing methods.
    Version:
    1.0
    Author:
    Dennis M. Sosnoski
    • Constructor Detail

      • BindingMethod

        protected BindingMethod​(ClassFile cf)
        Constructor.
        Parameters:
        cf - owning class file information
    • Method Detail

      • getClassFile

        public ClassFile getClassFile()
        Get class file containing method.
        Returns:
        class file owning this method
      • getName

        public abstract String getName()
        Get name of method. This abstract method must be implemented by every subclass.
        Returns:
        method name
      • getSignature

        public abstract String getSignature()
        Get signature. This abstract method must be implemented by every subclass.
        Returns:
        signature for method
      • getAccessFlags

        public abstract int getAccessFlags()
        Get access flags. This abstract method must be implemented by every subclass.
        Returns:
        flags for access type of method
      • setAccessFlags

        public abstract void setAccessFlags​(int flags)
        Set access flags. This abstract method must be implemented by every subclass.
        Parameters:
        flags - access type to be set
      • getMethod

        public abstract org.apache.bcel.classfile.Method getMethod()
        Get the actual method.
        Returns:
        method information
      • getItem

        public abstract ClassItem getItem()
        Get the method item.
        Returns:
        method item information
      • makeAccessible

        public void makeAccessible​(ClassFile src)
        Make accessible method. Check if this method is accessible from another class, and if not decreases the access restrictions to make it accessible.
        Parameters:
        src - class file for required access
      • computeMethodHash

        public static int computeMethodHash​(org.apache.bcel.classfile.Method method)
        Computes the hash code for a method. The hash code is based on the method signature, the exceptions thrown, and the actual byte code (including the exception handlers).
        Returns:
        computed hash code for method
      • hashCode

        public abstract int hashCode()
        Get hash code. This abstract method must be implemented by every subclass, using the same algorithm in each case. See one of the existing subclasses for details.
        Overrides:
        hashCode in class Object
        Returns:
        hash code for this method
      • equals

        public boolean equals​(Object obj)
        Check if objects are equal. Compares first based on hash code, then on the actual byte code sequence.
        Overrides:
        equals in class Object
        Returns:
        true if equal objects, false if not