|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IDOMMethod
Represents a method declaration. The corresponding syntactic units are MethodDeclaration (JLS2 8.4), ConstructorDeclaration (JLS2 8.8), and AbstractMethodDeclaration (JLS2 9.4). A method has no children and its parent is a type. Local classes are considered to be part of the body of a method, not a child. Annotation type members, added in J2SE 1.5, are represented as methods.
Field Summary |
---|
Fields inherited from interface org.eclipse.jdt.core.jdom.IDOMNode |
---|
COMPILATION_UNIT, FIELD, IMPORT, INITIALIZER, METHOD, PACKAGE, TYPE |
Method Summary | |
---|---|
void |
addException(java.lang.String exceptionType)
Deprecated. Adds the given exception to the end of the list of exceptions this method is declared to throw. |
void |
addParameter(java.lang.String type,
java.lang.String name)
Deprecated. Adds the given parameter to the end of the parameter list. |
java.lang.String |
getBody()
Deprecated. Returns the body of this method. |
java.lang.String |
getDefault()
Deprecated. Returns the default value expression for an annotation type member. |
java.lang.String[] |
getExceptions()
Deprecated. Returns the names of the exception types this method throws in the order in which they are declared in the source, or an empty array if this method declares no exception types. |
java.lang.String |
getName()
Deprecated. The IDOMMethod refinement of this IDOMNode
method returns the name of this method. |
java.lang.String[] |
getParameterNames()
Deprecated. Returns the names of parameters in this method in the order they are declared, or null if no parameters are declared. |
java.lang.String[] |
getParameterTypes()
Deprecated. Returns the type names for the parameters of this method in the order they are declared, or null if no parameters are declared. |
java.lang.String |
getReturnType()
Deprecated. Returns the return type name, or null . |
java.lang.String[] |
getTypeParameters()
Deprecated. Returns the formal type parameters for this method. |
boolean |
isConstructor()
Deprecated. Returns whether this method is a constructor. |
void |
setBody(java.lang.String body)
Deprecated. Sets the body of this method. |
void |
setConstructor(boolean b)
Deprecated. Sets whether this method represents a constructor. |
void |
setDefault(java.lang.String defaultValue)
Deprecated. Sets the default value expression for an annotation type member. |
void |
setExceptions(java.lang.String[] exceptionTypes)
Deprecated. Sets the names of the exception types this method throws, in the order in which they are declared in the source. |
void |
setName(java.lang.String name)
Deprecated. The IDOMMethod refinement of this IDOMNode
method sets the name of this method. |
void |
setParameters(java.lang.String[] types,
java.lang.String[] names)
Deprecated. Sets the types and names of parameters in this method in the order they are to be declared. |
void |
setReturnType(java.lang.String type)
Deprecated. Sets the return type name. |
void |
setTypeParameters(java.lang.String[] typeParameters)
Deprecated. Sets the formal type parameters for this method. |
Methods inherited from interface org.eclipse.jdt.core.jdom.IDOMMember |
---|
getComment, getFlags, setComment, setFlags |
Methods inherited from interface org.eclipse.jdt.core.jdom.IDOMNode |
---|
addChild, canHaveChildren, clone, getCharacters, getChild, getChildren, getContents, getFirstChild, getJavaElement, getNextNode, getNodeType, getParent, getPreviousNode, insertSibling, isAllowableChild, isSignatureEqual, remove |
Method Detail |
---|
void addException(java.lang.String exceptionType) throws java.lang.IllegalArgumentException
"IOException"
or "java.io.IOException"
.
This is a convenience method for setExceptions
.
exceptionType
- the exception type
java.lang.IllegalArgumentException
- if null
is specifiedsetExceptions(String[])
void addParameter(java.lang.String type, java.lang.String name) throws java.lang.IllegalArgumentException
setParameters
.
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[]"
.
type
- the type namename
- the parameter name
java.lang.IllegalArgumentException
- if null
is specified for
either the type or the namesetParameters(String[], String[])
java.lang.String getBody()
null
if the method has no body (for
example, for an abstract or native method)void setDefault(java.lang.String defaultValue)
defaultValue
- the default value expression, or null
indicating
the member does not have a default valuejava.lang.String getDefault()
null
indicating
the member does not have a default valuejava.lang.String[] getExceptions()
"IOException"
or "java.io.IOException"
.
java.lang.String[] getTypeParameters()
Formal type parameters are as they appear in the source
code; for example:
"X extends List<String> & Serializable"
.
java.lang.String getName()
IDOMMethod
refinement of this IDOMNode
method returns the name of this method. Returns null
for
constructors. The syntax for a method name is defined by Identifier
of MethodDeclarator (JLS2 8.4).
getName
in interface IDOMNode
null
for constructorsjava.lang.String[] getParameterNames()
null
if no parameters are declared.
The syntax for parameter names is defined by Formal Parameters (JLS2 8.4.1).
null
if no parameters
are declaredjava.lang.String[] getParameterTypes()
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[]"
.
null
if no parameters
are declaredjava.lang.String getReturnType()
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"
.
boolean isConstructor()
true
for constructors, and false
for methodsvoid setBody(java.lang.String body)
body
- the body, or null
indicating the method has no body (for
example, for an abstract or native method)void setConstructor(boolean b)
b
- true
for constructors, and false
for methodsvoid setExceptions(java.lang.String[] exceptionTypes)
"IOException"
or "java.io.IOException"
.
exceptionTypes
- the list of exception typesvoid setTypeParameters(java.lang.String[] typeParameters)
Formal type parameters are given as they appear in the source
code; for example:
"X extends List<String> & Serializable"
.
typeParameters
- the formal type parameters of this method,
in the order to appear in the source, an empty array if nonevoid setName(java.lang.String name) throws java.lang.IllegalArgumentException
IDOMMethod
refinement of this IDOMNode
method sets the name of this method. The syntax for a method
name is defined by Identifer of MethodDeclarator (JLS2 8.4).
The name of a constructor is always null
and thus it
must not be set.
setName
in interface IDOMNode
name
- the given name
java.lang.IllegalArgumentException
- if null
is specifiedvoid setParameters(java.lang.String[] types, java.lang.String[] names) throws java.lang.IllegalArgumentException
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[]"
.
types
- the list of type namesnames
- the list of parameter name
java.lang.IllegalArgumentException
- if the number of types and names do not
match, or if either argument is null
void setReturnType(java.lang.String type) throws java.lang.IllegalArgumentException
"File"
, "java.io.File"
,
"int[]"
, or "void"
.
type
- the return type
java.lang.IllegalArgumentException
- if null
is specified
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |