## org.eclipse.emf.codegen.merge.java.facade
Interface JMethod

All Superinterfaces:
  JMember, JNode

All Known Implementing Classes:
  ASTJMethod, JDOMJMethod

    public interface JMethod

extends JMember

Represents a method declaration.

Since:
  2.2.0

Method Summary
`void` `addException(java.lang.String exceptionType)` Adds the given exception to the end of the list of exceptions this method is declared to throw.
`java.lang.String` `getBody()` Returns the body of this method.
`java.lang.String[]` `getExceptions()` Returns the type signatures of the exceptions this method throws, in the order declared in the source.
`java.lang.String[]` `getFullParameterTypes()` Returns the full types for the parameters of this method in the order they are declared, or an empty array if no parameters are declared.
`java.lang.String[]` `getParameterNames()` Returns the names of parameters in this method in the order they are declared, or an empty array if no parameters are declared.
`java.lang.String[]` `getParameters()` Returns the parameters of this method in the order they are declared, or empty array if no parameters are declared.
`java.lang.String[]` `getParameterTypes()` Returns the erased type names for the parameters of this method in the order they are declared, or an empty array if no parameters are declared.
`java.lang.String` `getReturnType()` Returns the return type name, or `null`.
`java.lang.String[]` `getTypeParameters()` Returns the formal type parameters for this method.
`boolean` `isConstructor()` Returns whether this method is a constructor.
`void` `setBody(java.lang.String body)` Sets the body of this method.
`void` `setExceptions(java.lang.String[] exceptionTypes)` Sets the names of the exception types this method throws, in the order in which they are declared in the source.
`void` `setParameterNames(java.lang.String[] names)` Sets the names of parameters in this method in the order they are to be declared.
`void` `setParameters(java.lang.String[] parameters)` Sets the parameters in this method in the order they are to be declared.
`void` `setReturnType(java.lang.String type)` Sets the return type name.
`void` `setTypeParameters(java.lang.String[] typeParameters)` Sets the formal type parameters for this method.

Methods inherited from interface org.eclipse.emf.codegen.merge.java.facade.JMember
`getComment, setComment`

Methods inherited from interface org.eclipse.emf.codegen.merge.java.facade.JNode
`getChildren, getContents, getFlags, getName, getParent, getQualifiedName, setFlags, setName`

Method Detail

### isConstructor

    boolean isConstructor()

  Returns whether this method is a constructor.

  Returns:
    `true` for constructors, and `false` for methods

### getReturnType

    java.lang.String getReturnType()

  Returns the return type name, or `null`. Returns `null` for constructors. The syntax for return type name corresponds to ReturnType in MethodDeclaration (JLS2 8.4). Names are returned as they appear in the source code; for example: `"File"`, `"java.io.File"`, `"int[]"`, or `"void"`.

  Returns:
    the return type

### setReturnType

    void setReturnType(java.lang.String type)

  Sets the return type name. This has no effect on constructors. The syntax for return type name corresponds to ReturnType in MethodDeclaration (JLS2 8.4). Type names are specified as they appear in the source code; for example: `"File"`, `"java.io.File"`, `"int[]"`, or `"void"`.

  Parameters:
    `type` - the return type

### getTypeParameters

    java.lang.String[] getTypeParameters()

  Returns the formal type parameters for this method. Returns an empty array if this method has no formal type parameters.

  Formal type parameters are as they appear in the source code; for example: `"X extends List<String> & Serializable"`.

  Returns:
    the formal type parameters of this method, in the order declared in the source, or an empty array if no type parameters are declared

### setTypeParameters

    void setTypeParameters(java.lang.String[] typeParameters)

  Sets the formal type parameters for this method.

  Parameters:
    `typeParameters` - in the order declared in the source, or an empty array if no type parameters are declared
  Since:
    2.3.0

### getParameterNames

    java.lang.String[] getParameterNames()

  Returns the names of parameters in this method in the order they are declared, or an empty array if no parameters are declared. The parameter names are identifiers as defined by Formal Parameters (JLS2 and JLS3 8.4.1). Parameter names do not include extra dimensions.

  Returns:
    the list of parameter names, or an empty array if no parameters are declared

### getParameterTypes

    java.lang.String[] getParameterTypes()

  Returns the erased type names for the parameters of this method in the order they are declared, or an empty array if no parameters are declared. The syntax for type names is defined by Formal Parameters (JLS2 8.4.1). Type names must be specified as they would appear in source code. For example: `"File"`, `"java.io.File"`, or `"int[]"`.

  Returns:
    the list of the erased types of the parameters, or an empty array if no parameters are declared

### getFullParameterTypes

    java.lang.String[] getFullParameterTypes()

  Returns the full types for the parameters of this method in the order they are declared, or an empty array if no parameters are declared. The syntax for type names is defined by Formal Parameters (JLS2 8.4.1). Type names must be specified as they would appear in source code. For example: `"File"`, `"java.io.File"`, or `"int[]"`.

  Returns:
    the list of the full types of the parameters, or an empty array if no parameters are declared
  Since:
    2.4

### setParameterNames

    void setParameterNames(java.lang.String[] names)
                           throws java.lang.IllegalArgumentException

  Sets the names of parameters in this method in the order they are to be declared. The parameter names are identifiers as defined by Formal Parameters (JLS2 and JLS3 8.4.1). Parameter names do not include extra dimensions.

  Parameters:
    `names` - the list of parameter names
  Throws:
    `java.lang.IllegalArgumentException`

### getParameters

    java.lang.String[] getParameters()

  Returns the parameters of this method in the order they are declared, or empty array if no parameters are declared. The syntax for the parameters is defined by Formal Parameters (JLS2 and JLS3 8.4.1). Types and parameter names must be specified as they would appear in source code. For example: `"File file"`, `"java.io.File file"`, or `"int[][] n[]"`, or `final @Annotation int[]... n`.

  Returns:
    the list of parameters, or or an empty array if no parameters are declared
  Since:
    2.3.0

### setParameters

    void setParameters(java.lang.String[] parameters)

  Sets the parameters in this method in the order they are to be declared. The syntax for the parameters is defined by Formal Parameters (JLS2 and JLS3 8.4.1). Types and parameter names must be specified as they would appear in source code. For example: `"File file"`, `"java.io.File file"`, or `"int[][] n[]"`, or `final @Annotation int[]... n`.

  Parameters:
    `parameters` - the list of parameters, or or an empty array if no parameters are declared
  Since:
    2.3.0

### getExceptions

    java.lang.String[] getExceptions()

  Returns the type signatures of the exceptions this method throws, in the order declared in the source. Returns an empty array if this method throws no exceptions.

  For example, a source method declaring `"throws IOException"`, would return the array `{"QIOException;"}`.

  The type signatures may be either unresolved (for source types) or resolved (for binary types), and either basic (for basic types) or rich (for parameterized types).

  Returns:
    the list of the exceptions, or an empty array if no exceptions are declared

### setExceptions

    void setExceptions(java.lang.String[] exceptionTypes)

  Sets the names of the exception types this method throws, in the order in which they are declared in the source. An empty array indicates this method declares no exception types. The syntax for an exception type name is defined by Method Throws (JLS2 8.4.4). Type names must be specified as they would appear in source code. For example: `"IOException"` or `"java.io.IOException"`.

  Parameters:
    `exceptionTypes` - the list of exception types

### addException

    void addException(java.lang.String exceptionType)

  Adds the given exception to the end of the list of exceptions this method is declared to throw. The syntax for an exception type name is defined by Method Throws (JLS2 8.4.4). Type names must be specified as they would appear in source code. For example: `"IOException"` or `"java.io.IOException"`. This is a convenience method for `setExceptions`.

  Parameters:
    `exceptionType` - the exception type
  See Also:
    `setExceptions(String[])`

### getBody

    java.lang.String getBody()

  Returns the body of this method. The method body includes all code following the method declaration, including the enclosing braces.

  Returns:
    the body, or `null` if the method has no body (for example, for an abstract or native method)

### setBody

    void setBody(java.lang.String body)

  Sets the body of this method. The method body includes all code following the method declaration, including the enclosing braces. No formatting or syntax checking is performed on the body.

  Parameters:
    `body` - the body, or `null` indicating the method has no body (for example, for an abstract or native method)

Copyright 2001-2006 IBM Corporation and others. All Rights Reserved.