# Interface: com.pnfsoftware.jeb.core.units.code.java.IJavaMethod

Java AST interface to represent a Java method.

## Method: deleteStatement
- parameter: `stm`, type: `com.pnfsoftware.jeb.core.units.code.java.IJavaStatement`
- return type: `boolean`

Description: Delete a statement by reference. This method performs a deep search within the entire method. This works because no method should contain the same statement \(in the sense, same reference\) twice.
parameter: stm: the statement to delete
return: true if the statement was found and deleted

## Method: duplicate
- return type: `com.pnfsoftware.jeb.core.units.code.java.IJavaMethod`


## Method: fromFlatList
- parameter: `list`, type: `java.util.List<com.pnfsoftware.jeb.core.units.code.java.IJavaStatement>`

Description: Replace the method body from a flat statement list.
parameter: list: statements to use as the method body

## Method: generate
- parameter: `out`, type: `com.pnfsoftware.jeb.core.units.code.java.JavaOutputSink`
- parameter: `bodyOnly`, type: `boolean`

Description: Generate this method.
parameter: out: output sink
parameter: bodyOnly: true to generate only the method body

## Method: generate
- parameter: `out`, type: `com.pnfsoftware.jeb.core.units.code.java.JavaOutputSink`
- parameter: `genkind`, type: `int`

Description: Generate this method.
parameter: out: output sink
parameter: genkind: 0= regular method; 1= just the body of the method; 2= the method is a lambda

## Method: getAccessFlags
- return type: `int`

Description: Retrieve the method access flags.
return: access flags

## Method: getAnonymousClassSignatures
- return type: `java.util.List<java.lang.String>`

Description: Retrieve the signatures of anonymous classes declared by this method.
return: anonymous class signatures

## Method: getAnonymousClasses
- return type: `java.util.List<com.pnfsoftware.jeb.core.units.code.java.IJavaClass>`

Description: Retrieve anonymous classes declared by this method.
return: anonymous classes

## Method: getBody
- return type: `com.pnfsoftware.jeb.core.units.code.java.IJavaBlock`

Description: Get the body of the method.
return: the body, null if none

## Method: getClassType
- return type: `com.pnfsoftware.jeb.core.units.code.java.IJavaType`

Description: Get the type of the entity containing this method.
return: the containing class type

## Method: getDefaultValue
- return type: `com.pnfsoftware.jeb.core.units.code.java.IJavaExpression`

Description: Get the default value provided by this method if there is one. 

 **Implementation note:** currently used for annotation types only: if this object is an annotation method \(i.e. it represents an attribute of an annotation type\), this method will return the default value associated to this attribute, if there is one.
return: a default value or null

## Method: getIdentifierManager
- return type: `com.pnfsoftware.jeb.core.units.code.java.IJavaIdentifierManager`

Description: Retrieve the identifier manager associated with this method.
return: the identifier manager

## Method: getIndexOfFirstVisibleParameter
- return type: `int`

Description: Retrieve the index of the first visible parameter.
return: first visible parameter index

## Method: getInnerClassSignatures
- return type: `java.util.List<java.lang.String>`

Description: Retrieve the signatures of inner classes declared by this method.
return: inner class signatures

## Method: getInnerClasses
- return type: `java.util.List<com.pnfsoftware.jeb.core.units.code.java.IJavaClass>`

Description: Retrieve inner classes declared by this method.
return: inner classes

## Method: getLabelFactory
- return type: `com.pnfsoftware.jeb.core.units.code.java.IJavaLabelFactory`

Description: Retrieve the label factory associated with this method.
return: the label factory

## Method: getMethodAnnotations
- return type: `java.util.List<com.pnfsoftware.jeb.core.units.code.java.IJavaAnnotation>`

Description: Retrieve method annotations.
return: method annotations

## Method: getName
- return type: `java.lang.String`

Description: Get the original method name. The returned name is a simple name, without parameter, return, or type information.
return: the method name

## Method: getParameter
- parameter: `index`, type: `int`
- return type: `com.pnfsoftware.jeb.core.units.code.java.IJavaDefinition`

Description: Retrieve a method parameter by index.
parameter: index: parameter index
return: the parameter definition

## Method: getParameterAnnotations
- parameter: `index`, type: `int`
- return type: `java.util.List<com.pnfsoftware.jeb.core.units.code.java.IJavaAnnotation>`

Description: Retrieve annotations for a parameter.
parameter: index: parameter index
return: parameter annotations

## Method: getParameterCount
- return type: `int`

Description: Retrieve the total number of parameters, including hidden parameters.
return: parameter count

## Method: getParameters
- return type: `java.util.List<com.pnfsoftware.jeb.core.units.code.java.IJavaDefinition>`

Description: Get the parameters of the method. 

 Note: If the method is non\-static, the first parameter in the list would be \`this\`.
return: the list of parameters

## Method: getReturnType
- return type: `com.pnfsoftware.jeb.core.units.code.java.IJavaType`

Description: Get the return type of the method.
return: the return type

## Method: getSignature
- return type: `java.lang.String`

Description: Get the original method signature.
return: the method signature

## Method: getStatements
- return type: `java.util.List<com.pnfsoftware.jeb.core.units.code.java.IJavaStatement>`

Description: Walk the tree and get the ordered list of all \(non\-pseudo\) statements that make up the method.
return: ordered method statements

## Method: getVisibleParameterCount
- return type: `int`

Description: Retrieve the number of visible parameters.
return: visible parameter count

## Method: getVisibleParameters
- return type: `java.util.List<com.pnfsoftware.jeb.core.units.code.java.IJavaDefinition>`

Description: Retrieve the visible parameters.
return: list of visible parameter definitions

## Method: isAbstract
- return type: `boolean`

Description: Determine whether this method is abstract.
return: true if the method is abstract

## Method: isClassConstructor
- return type: `boolean`

Description: Determine whether this method is a class constructor.
return: true if this method is a class constructor

## Method: isClassInitializer
- return type: `boolean`

Description: Determine whether this method is a class initializer.
return: true if this method is a class initializer

## Method: isConstructor
- return type: `boolean`

Description: Determine whether this method is an instance constructor.
return: true if this method is a constructor

## Method: isEmpty
- return type: `boolean`

Description: Determine whether the method body is empty.
return: true if the method has no statements

## Method: isInner
- return type: `boolean`

Description: Determine whether this method belongs to an inner type.
return: true if the method belongs to an inner type

## Method: isNative
- return type: `boolean`

Description: Determine whether this method is native.
return: true if the method is native

## Method: isPrivate
- return type: `boolean`

Description: Determine whether this method is private.
return: true if the method is private

## Method: isProtected
- return type: `boolean`

Description: Determine whether this method is protected.
return: true if the method is protected

## Method: isPublic
- return type: `boolean`

Description: Determine whether this method is public.
return: true if the method is public

## Method: isSecondParameterOuterClassReference
- return type: `boolean`

Description: Determine whether the second parameter is an outer\-class reference.
return: true if the second parameter is an outer\-class reference

## Method: isStatic
- return type: `boolean`

Description: Determine whether this method is a static method.
return: true if the method is static, false otherwise \(virtual method\)

## Method: isSynthetic
- return type: `boolean`

Description: Determine whether this method is synthetic.
return: true if the method is synthetic

## Method: markSecondParameterOuterClassReference

Description: Mark the second parameter as an outer\-class reference.

## Method: setDefaultValue
- parameter: `defaultValue`, type: `com.pnfsoftware.jeb.core.units.code.java.IJavaExpression`

Description: Set the default value associated with this method.
parameter: defaultValue: default value, or null

## Method: setIndexOfFirstVisibleParameter
- parameter: `index`, type: `int`

Description: Set the index of the first visible parameter.
parameter: index: parameter index

## Method: toFlatList
- return type: `java.util.List<com.pnfsoftware.jeb.core.units.code.java.IJavaStatement>`

Description: Flatten the method body into a statement list.
return: flattened statements

