Package serp.bytecode

Class BCMethod

    • Method Detail

      • isSynchronized

        public boolean isSynchronized()
        Manipulate the method access flags.
      • setSynchronized

        public void setSynchronized​(boolean on)
        Manipulate the method access flags.
      • isNative

        public boolean isNative()
        Manipulate the method access flags.
      • setNative

        public void setNative​(boolean on)
        Manipulate the method access flags.
      • isAbstract

        public boolean isAbstract()
        Manipulate the method access flags.
      • setAbstract

        public void setAbstract​(boolean on)
        Manipulate the method access flags.
      • isStrict

        public boolean isStrict()
        Manipulate the method access flags.
      • setStrict

        public void setStrict​(boolean on)
        Manipulate the method access flags.
      • isVarArgs

        public boolean isVarArgs()
        Manipulate the method access flags.
      • setVarArgs

        public void setVarArgs​(boolean on)
        Manipulate the method access flags.
      • isBridge

        public boolean isBridge()
        Manipulate the method access flags.
      • setBridge

        public void setBridge​(boolean on)
        Manipulate the method access flags.
      • getReturnName

        public java.lang.String getReturnName()
        Return the name of the type returned by this method. The name will be given in a form suitable for a Class.forName(java.lang.String) call.
        See Also:
        BCMember.getDescriptor()
      • getReturnType

        public java.lang.Class getReturnType()
        Return the Class object for the return type of this method.
        See Also:
        BCMember.getDescriptor()
      • setReturn

        public void setReturn​(java.lang.String name)
        Set the return type of this method.
      • setReturn

        public void setReturn​(java.lang.Class type)
        Set the return type of this method.
      • setReturn

        public void setReturn​(BCClass type)
        Set the return type of this method.
      • getParamNames

        public java.lang.String[] getParamNames()
        Return the names of all the parameter types for this method. The names will be returned in a form suitable for a Class.forName(java.lang.String) call.
        See Also:
        BCMember.getDescriptor()
      • getParamTypes

        public java.lang.Class[] getParamTypes()
        Return the Class objects for all the parameter types for this method.
        See Also:
        BCMember.getDescriptor()
      • addParam

        public void addParam​(java.lang.String type)
        Add a parameter type to this method.
      • addParam

        public void addParam​(java.lang.Class type)
        Add a parameter type to this method.
      • addParam

        public void addParam​(BCClass type)
        Add a parameter type to this method.
      • addParam

        public void addParam​(int pos,
                             java.lang.String type)
        Add a parameter type to this method.
        See Also:
        List.add(int,Object)
      • addParam

        public void addParam​(int pos,
                             java.lang.Class type)
        Add a parameter type to this method.
        See Also:
        List.add(int,Object)
      • addParam

        public void addParam​(int pos,
                             BCClass type)
        Add a parameter type to this method.
        See Also:
        List.add(int,Object)
      • setParam

        public void setParam​(int pos,
                             java.lang.String type)
        Change a parameter type of this method.
        See Also:
        List.set(int,Object)
      • setParam

        public void setParam​(int pos,
                             java.lang.Class type)
        Change a parameter type of this method.
        See Also:
        List.set(int,Object)
      • setParam

        public void setParam​(int pos,
                             BCClass type)
        Change a parameter type of this method.
        See Also:
        List.set(int,Object)
      • clearParams

        public void clearParams()
        Clear all parameters from this method.
      • removeParam

        public void removeParam​(int pos)
        Remove a parameter from this method.
      • getExceptions

        public Exceptions getExceptions​(boolean add)
        Return the checked exceptions information for the method. Acts internally through the Attributes interface.
        Parameters:
        add - if true, a new exceptions attribute will be added if not already present
        Returns:
        the exceptions information, or null if none and the add param is set to false
      • removeExceptions

        public boolean removeExceptions()
        Remove the exceptions attribute for the method. Acts internally through the Attributes interface.
        Returns:
        true if there was a value to remove
      • getCode

        public Code getCode​(boolean add)
        Return the code for the method. If the code already exists, its iterator will be reset to the first instruction. Acts internally through the Attributes interface.
        Parameters:
        add - if true, a new code attribute will be added if not already present
        Returns:
        the code for the metohd, or null if none and the add param is set to false
      • removeCode

        public boolean removeCode()
        Remove the code attribute from the method. Acts internally through the Attributes interface.
        Returns:
        true if there was a value to remove
      • acceptVisit

        public void acceptVisit​(BCVisitor visit)
        Description copied from interface: VisitAcceptor
        Accept a visit from a BCVisitor, calling the appropriate methods to notify the visitor that it has entered this entity, and to provide it with the proper callbacks for each sub-entity owned by this one.
        Specified by:
        acceptVisit in interface VisitAcceptor