org.eclipse.emf.codegen.merge.java.facade.jdom
Class JDOMJMethod

java.lang.Object
  extended byorg.eclipse.emf.codegen.merge.java.facade.AbstractJNode
      extended byorg.eclipse.emf.codegen.merge.java.facade.jdom.JDOMJNode
          extended byorg.eclipse.emf.codegen.merge.java.facade.jdom.JDOMJMember
              extended byorg.eclipse.emf.codegen.merge.java.facade.jdom.JDOMJMethod
All Implemented Interfaces:
JMember, JMethod, JNode

public class JDOMJMethod
extends JDOMJMember
implements JMethod

Since:
2.2.0

Field Summary
 
Fields inherited from class org.eclipse.emf.codegen.merge.java.facade.AbstractJNode
EMPTY_STRING_ARRAY, facadeHelper, qualifiedName, wrappedObject
 
Constructor Summary
JDOMJMethod(org.eclipse.jdt.core.jdom.IDOMMethod method)
           
 
Method Summary
 void addException(String exceptionType)
          Adds the given exception to the end of the list of exceptions this method is declared to throw.
protected  String computeQualifiedName()
           
 String getBody()
          Returns the body of this method.
 String[] getExceptions()
          Returns the type signatures of the exceptions this method throws, in the order declared in the source.
protected  org.eclipse.jdt.core.jdom.IDOMMethod getIDOMMethod()
           
 String[] getParameterNames()
          Returns the names of parameters in this method in the order they are declared, or null if no parameters are declared.
 String[] getParameterTypes()
          Returns the type names for the parameters of this method in the order they are declared, or null if no parameters are declared.
 String getReturnType()
          Returns the return type name, or null.
 String[] getTypeParameters()
          Returns the formal type parameters for this method.
 boolean isConstructor()
          Returns whether this method is a constructor.
 void setBody(String body)
          Sets the body of this method.
 void setExceptions(String[] exceptionTypes)
          Sets the names of the exception types this method throws, in the order in which they are declared in the source.
 void setParameters(String[] types, String[] names)
          Sets the types and names of parameters in this method in the order they are to be declared.
 void setReturnType(String type)
          Sets the return type name.
 
Methods inherited from class org.eclipse.emf.codegen.merge.java.facade.jdom.JDOMJMember
getComment, getContents, getFlags, getIDOMMember, setComment, setFlags, splitLastComment
 
Methods inherited from class org.eclipse.emf.codegen.merge.java.facade.jdom.JDOMJNode
getChildren, getIDOMNode, getName, getParent
 
Methods inherited from class org.eclipse.emf.codegen.merge.java.facade.AbstractJNode
computeQualifiedName, computeQualifiedName, computeQualifiedName, dispose, getFacadeHelper, getName, getQualifiedName, getWrappedObject, setFacadeHelper
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
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
 

Constructor Detail

JDOMJMethod

public JDOMJMethod(org.eclipse.jdt.core.jdom.IDOMMethod method)
Parameters:
method -
Method Detail

getIDOMMethod

protected org.eclipse.jdt.core.jdom.IDOMMethod getIDOMMethod()

isConstructor

public boolean isConstructor()
Description copied from interface: JMethod
Returns whether this method is a constructor.

Specified by:
isConstructor in interface JMethod
Returns:
true for constructors, and false for methods

getBody

public String getBody()
Description copied from interface: JMethod
Returns the body of this method. The method body includes all code following the method declaration, including the enclosing braces.

Specified by:
getBody in interface JMethod
Returns:
the body, or null if the method has no body (for example, for an abstract or native method)

setBody

public void setBody(String body)
Description copied from interface: JMethod
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.

Specified by:
setBody in interface JMethod
Parameters:
body - the body, or null indicating the method has no body (for example, for an abstract or native method)

getReturnType

public String getReturnType()
Description copied from interface: JMethod
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".

Specified by:
getReturnType in interface JMethod
Returns:
the return type

setReturnType

public void setReturnType(String type)
Description copied from interface: JMethod
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".

Specified by:
setReturnType in interface JMethod
Parameters:
type - the return type

getParameterNames

public String[] getParameterNames()
Description copied from interface: JMethod
Returns the names of parameters in this method in the order they are declared, or null if no parameters are declared. The syntax for parameter names is defined by Formal Parameters (JLS2 8.4.1).

Specified by:
getParameterNames in interface JMethod
Returns:
the list of parameter names, or an empty array if no parameters are declared

getParameterTypes

public String[] getParameterTypes()
Description copied from interface: JMethod
Returns the type names for the parameters of this method in the order they are declared, or null 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[]".

Specified by:
getParameterTypes in interface JMethod
Returns:
the list of parameter types, or an empty array if no parameters are declared

getTypeParameters

public String[] getTypeParameters()
Description copied from interface: JMethod
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".

Specified by:
getTypeParameters in interface JMethod
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

setParameters

public void setParameters(String[] types,
                          String[] names)
                   throws IllegalArgumentException
Description copied from interface: JMethod
Sets the types and names of parameters in this method in the order they are to be declared. If both types and names are null this indicates that this method has no parameters. The syntax for parameter names is defined by Formal Parameters (JLS2 8.4.1). 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[]".

Specified by:
setParameters in interface JMethod
Parameters:
types - the list of type names
names - the list of parameter name
Throws:
IllegalArgumentException

getExceptions

public String[] getExceptions()
Description copied from interface: JMethod
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).

Specified by:
getExceptions in interface JMethod
Returns:
the list of the exceptions, or an empty array if no exceptions are declared

setExceptions

public void setExceptions(String[] exceptionTypes)
Description copied from interface: JMethod
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".

Specified by:
setExceptions in interface JMethod
Parameters:
exceptionTypes - the list of exception types

addException

public void addException(String exceptionType)
Description copied from interface: JMethod
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.

Specified by:
addException in interface JMethod
Parameters:
exceptionType - the exception type
See Also:
JMethod.setExceptions(String[])

computeQualifiedName

protected String computeQualifiedName()
Overrides:
computeQualifiedName in class AbstractJNode

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