Class Method

All Implemented Interfaces:
Node

public final class Method extends FieldOrMethod
This class represents the method info structure, i.e., the representation for a method in the class. See JVM specification for details. A method has access flags, a name, a signature and a number of attributes.
Version:
$Id: Method.java,v 1.11 2009/09/15 19:40:12 aclement Exp $
Author:
M. Dahm
  • Field Details

    • NO_PARAMETER_ANNOTATIONS

      public static final AnnotationGen[][] NO_PARAMETER_ANNOTATIONS
    • NoMethods

      public static final Method[] NoMethods
  • Constructor Details

    • Method

      public Method(Method c)
      Initialize from another object. Note that both objects use the same references (shallow copy). Use clone() for a physical copy.
    • Method

      public Method(int access_flags, int name_index, int signature_index, Attribute[] attributes, ConstantPool constant_pool)
  • Method Details

    • accept

      public void accept(ClassVisitor v)
    • setAttributes

      public void setAttributes(Attribute[] attributes)
      Overrides:
      setAttributes in class FieldOrMethod
      Parameters:
      attributes - Collection of object attributes.
    • getCode

      public final Code getCode()
      Returns:
      Code attribute of method, if any
    • getExceptionTable

      public final ExceptionTable getExceptionTable()
    • getLocalVariableTable

      public final LocalVariableTable getLocalVariableTable()
      Return LocalVariableTable of code attribute if any (the call is forwarded to the Code attribute)
    • getLineNumberTable

      public final LineNumberTable getLineNumberTable()
      Return LineNumberTable of code attribute if any (the call is forwarded to the Code attribute)
    • toString

      public final String toString()
      Return string representation close to declaration format, eg: 'public static void main(String[] args) throws IOException'
      Overrides:
      toString in class Object
    • getReturnType

      public Type getReturnType()
      Returns:
      return type of method
    • getArgumentTypes

      public Type[] getArgumentTypes()
      Returns:
      array of method argument types
    • getAnnotationsOnParameter

      public AnnotationGen[] getAnnotationsOnParameter(int i)
    • getParameterAnnotations

      public AnnotationGen[][] getParameterAnnotations()