Schnittstelle IDOMMethod
- Alle Superschnittstellen:
Cloneable
,IDOMMember
,IDOMNode
Veraltet.
The JDOM was made obsolete by the addition in 2.0 of the more
powerful, fine-grained DOM/AST API found in the
org.aspectj.org.eclipse.jdt.core.dom package.
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.
-
Feldübersicht
Von Schnittstelle geerbte Felder org.aspectj.org.eclipse.jdt.core.jdom.IDOMNode
COMPILATION_UNIT, FIELD, IMPORT, INITIALIZER, METHOD, PACKAGE, TYPE
-
Methodenübersicht
Modifizierer und TypMethodeBeschreibungvoid
addException
(String exceptionType) Veraltet.Adds the given exception to the end of the list of exceptions this method is declared to throw.void
addParameter
(String type, String name) Veraltet.Adds the given parameter to the end of the parameter list.getBody()
Veraltet.Returns the body of this method.Veraltet.Returns the default value expression for an annotation type member.String[]
Veraltet.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.getName()
Veraltet.TheIDOMMethod
refinement of thisIDOMNode
method returns the name of this method.String[]
Veraltet.Returns the names of parameters in this method in the order they are declared, ornull
if no parameters are declared.String[]
Veraltet.Returns the type names for the parameters of this method in the order they are declared, ornull
if no parameters are declared.Veraltet.Returns the return type name, ornull
.String[]
Veraltet.Returns the formal type parameters for this method.boolean
Veraltet.Returns whether this method is a constructor.void
Veraltet.Sets the body of this method.void
setConstructor
(boolean b) Veraltet.Sets whether this method represents a constructor.void
setDefault
(String defaultValue) Veraltet.Sets the default value expression for an annotation type member.void
setExceptions
(String[] exceptionTypes) Veraltet.Sets the names of the exception types this method throws, in the order in which they are declared in the source.void
Veraltet.TheIDOMMethod
refinement of thisIDOMNode
method sets the name of this method.void
setParameters
(String[] types, String[] names) Veraltet.Sets the types and names of parameters in this method in the order they are to be declared.void
setReturnType
(String type) Veraltet.Sets the return type name.void
setTypeParameters
(String[] typeParameters) Veraltet.Sets the formal type parameters for this method.Von Schnittstelle geerbte Methoden org.aspectj.org.eclipse.jdt.core.jdom.IDOMMember
getComment, getFlags, setComment, setFlags
Von Schnittstelle geerbte Methoden org.aspectj.org.eclipse.jdt.core.jdom.IDOMNode
addChild, canHaveChildren, clone, getCharacters, getChild, getChildren, getContents, getFirstChild, getJavaElement, getNextNode, getNodeType, getParent, getPreviousNode, insertSibling, isAllowableChild, isSignatureEqual, remove
-
Methodendetails
-
addException
Veraltet.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 forsetExceptions
.- Parameter:
exceptionType
- the exception type- Löst aus:
IllegalArgumentException
- ifnull
is specified- Siehe auch:
-
addParameter
Veraltet.Adds the given parameter to the end of the parameter list. This is a convenience method forsetParameters
. 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[]"
.- Parameter:
type
- the type namename
- the parameter name- Löst aus:
IllegalArgumentException
- ifnull
is specified for either the type or the name- Siehe auch:
-
getBody
String getBody()Veraltet.Returns the body of this method. The method body includes all code following the method declaration, including the enclosing braces.- Gibt zurück:
- the body, or
null
if the method has no body (for example, for an abstract or native method)
-
setDefault
Veraltet.Sets the default value expression for an annotation type member.- Parameter:
defaultValue
- the default value expression, ornull
indicating the member does not have a default value- Seit:
- 3.0
-
getDefault
String getDefault()Veraltet.Returns the default value expression for an annotation type member.- Gibt zurück:
- the default value expression, or
null
indicating the member does not have a default value - Seit:
- 3.0
-
getExceptions
String[] getExceptions()Veraltet.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. The syntax for an exception type name is defined by Method Throws (JLS2 8.4.4). Type names appear as they would in source code. For example:"IOException"
or"java.io.IOException"
.- Gibt zurück:
- the list of exception types
-
getTypeParameters
String[] getTypeParameters()Veraltet.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> Ungültige Eingabe: "&" Serializable"
.- Gibt zurück:
- the formal type parameters of this method, in the order declared in the source, an empty array if none
- Seit:
- 3.0
-
getName
String getName()Veraltet.TheIDOMMethod
refinement of thisIDOMNode
method returns the name of this method. Returnsnull
for constructors. The syntax for a method name is defined by Identifier of MethodDeclarator (JLS2 8.4). -
getParameterNames
String[] getParameterNames()Veraltet.Returns the names of parameters in this method in the order they are declared, ornull
if no parameters are declared. The syntax for parameter names is defined by Formal Parameters (JLS2 8.4.1).- Gibt zurück:
- the list of parameter names, or
null
if no parameters are declared
-
getParameterTypes
String[] getParameterTypes()Veraltet.Returns the type names for the parameters of this method in the order they are declared, ornull
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[]"
.- Gibt zurück:
- the list of parameter types, or
null
if no parameters are declared
-
getReturnType
String getReturnType()Veraltet.Returns the return type name, ornull
. Returnsnull
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"
.- Gibt zurück:
- the return type
-
isConstructor
boolean isConstructor()Veraltet.Returns whether this method is a constructor.- Gibt zurück:
true
for constructors, andfalse
for methods
-
setBody
Veraltet.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.- Parameter:
body
- the body, ornull
indicating the method has no body (for example, for an abstract or native method)
-
setConstructor
void setConstructor(boolean b) Veraltet.Sets whether this method represents a constructor.- Parameter:
b
-true
for constructors, andfalse
for methods
-
setExceptions
Veraltet.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"
.- Parameter:
exceptionTypes
- the list of exception types
-
setTypeParameters
Veraltet.Sets the formal type parameters for this method.Formal type parameters are given as they appear in the source code; for example:
"X extends List<String> Ungültige Eingabe: "&" Serializable"
.- Parameter:
typeParameters
- the formal type parameters of this method, in the order to appear in the source, an empty array if none- Seit:
- 3.0
-
setName
Veraltet.TheIDOMMethod
refinement of thisIDOMNode
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.- Angegeben von:
setName
in SchnittstelleIDOMNode
- Parameter:
name
- the given name- Löst aus:
IllegalArgumentException
- ifnull
is specified
-
setParameters
Veraltet.Sets the types and names of parameters in this method in the order they are to be declared. If bothtypes
andnames
arenull
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[]"
.- Parameter:
types
- the list of type namesnames
- the list of parameter name- Löst aus:
IllegalArgumentException
- if the number of types and names do not match, or if either argument isnull
-
setReturnType
Veraltet.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"
.- Parameter:
type
- the return type- Löst aus:
IllegalArgumentException
- ifnull
is specified
-