Package org.codehaus.janino.util

# Class ClassFile.MethodInfo

java.lang.Object
org.codehaus.janino.util.ClassFile.MethodInfo

All Implemented Interfaces:
  `Annotatable`

Enclosing class:
  `ClassFile`

public class ClassFile.MethodInfo extends Object implements Annotatable
Representation of a "method_info" structure, as defined by JVMS7 4.6.

## Constructor Summary

Constructors
Constructor
Description
`MethodInfo(short accessFlags, short nameIndex, short descriptorIndex, List<ClassFile.AttributeInfo> attributes)`
Initializes the "method_info" structure.

## Method Summary

Modifier and Type
Method
Description
`void`
`addAnnotationsAttributeEntry(boolean runtimeVisible, String fieldDescriptor, Map<Short,ClassFile.ElementValue> elementValuePairs)`
Adds a "Runtime[In]visibleAnnotations" attribute to `this` object (if that annotation does not yet exist) and adds an entry to it.
`void`
`addAttribute(ClassFile.AttributeInfo attribute)`
Adds the attribute to this method.
`short`
`getAccessFlags()`
`ClassFile.Annotation[]`
`getAnnotations(boolean runtimeVisible)`
`ClassFile.AttributeInfo[]`
`getAttributes()`
`ClassFile`
`getClassFile()`
`String`
`getDescriptor()`
`String`
`getName()`
`void`
`store(DataOutputStream dos)`
Writes this object to a `DataOutputStream`, in the format described inJVMS7 4.6.
`String`
`toString()`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Constructor Details

### MethodInfo

public MethodInfo(short accessFlags, short nameIndex, short descriptorIndex, List<ClassFile.AttributeInfo> attributes)
Initializes the "method_info" structure.

## Method Details

### getClassFile

public ClassFile getClassFile()

Returns:
  The `ClassFile` that contains this `ClassFile.MethodInfo` object

### getAccessFlags

public short getAccessFlags()

Returns:
  The access flags of this method; or'ed values are the constants declared in `Mod`.

### getAnnotations

public ClassFile.Annotation[] getAnnotations(boolean runtimeVisible)

Specified by:
  `getAnnotations` in interface `Annotatable`
Returns:
  The annotations of this method

### getName

public String getName()

Returns:
  The method's name

### getDescriptor

public String getDescriptor()

Returns:
  The method descriptor describing this method

### getAttributes

public ClassFile.AttributeInfo[] getAttributes()

Returns:
  The attributes of this method

### addAttribute

public void addAttribute(ClassFile.AttributeInfo attribute)
Adds the attribute to this method.

### addAnnotationsAttributeEntry

public void addAnnotationsAttributeEntry(boolean runtimeVisible, String fieldDescriptor, Map<Short,ClassFile.ElementValue> elementValuePairs)
Description copied from interface: `Annotatable`
Adds a "Runtime[In]visibleAnnotations" attribute to `this` object (if that annotation does not yet exist) and adds an entry to it.

Specified by:
  `addAnnotationsAttributeEntry` in interface `Annotatable`
Parameters:
  `elementValuePairs` - Maps "elemant_name_index" (`ClassFile.ConstantUtf8Info`) to "element_value", see JVMS8 4.7.16

### store

public void store(DataOutputStream dos) throws IOException
Writes this object to a `DataOutputStream`, in the format described inJVMS7 4.6.

Throws:
  `IOException`

### toString

public String toString()

Overrides:
  `toString` in class `Object`