Interface IDOMMethod

All Superinterfaces:
Cloneable, IDOMMember, IDOMNode

public interface IDOMMethod extends IDOMMember
Deprecated.
The JDOM was made obsolete by the addition in 2.0 of the more powerful, fine-grained DOM/AST API found in the 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.
  • Field Summary

    Fields inherited from interface IDOMNode

    COMPILATION_UNIT, FIELD, IMPORT, INITIALIZER, METHOD, PACKAGE, TYPE
    Modifier and Type
    Field
    Description
    static final int
    Deprecated.
    Node type constant indicating a compilation unit.
    static final int
    Deprecated.
    Node type constant indicating a field declaration.
    static final int
    Deprecated.
    Node type constant indicating an import declaration.
    static final int
    Deprecated.
    Node type constant indicating an initializer declaration.
    static final int
    Deprecated.
    Node type constant indicating a method (or constructor) declaration.
    static final int
    Deprecated.
    Node type constant indicating a package declaration.
    static final int
    Deprecated.
    Node type constant indicating a type declaration.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addException(String exceptionType)
    Deprecated.
    Adds the given exception to the end of the list of exceptions this method is declared to throw.
    void
    addParameter(String type, String name)
    Deprecated.
    Adds the given parameter to the end of the parameter list.
    Deprecated.
    Returns the body of this method.
    Deprecated.
    Returns the default value expression for an annotation type member.
    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.
    Deprecated.
    The IDOMMethod refinement of this IDOMNode method returns the name of this method.
    Deprecated.
    Returns the names of parameters in this method in the order they are declared, or null if no parameters are declared.
    Deprecated.
    Returns the type names for the parameters of this method in the order they are declared, or null if no parameters are declared.
    Deprecated.
    Returns the return type name, or null.
    Deprecated.
    Returns the formal type parameters for this method.
    boolean
    Deprecated.
    Returns whether this method is a constructor.
    void
    Deprecated.
    Sets the body of this method.
    void
    setConstructor(boolean b)
    Deprecated.
    Sets whether this method represents a constructor.
    void
    setDefault(String defaultValue)
    Deprecated.
    Sets the default value expression for an annotation type member.
    void
    setExceptions(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
    Deprecated.
    The IDOMMethod refinement of this IDOMNode method sets the name of this method.
    void
    setParameters(String[] types, String[] names)
    Deprecated.
    Sets the types and names of parameters in this method in the order they are to be declared.
    void
    Deprecated.
    Sets the return type name.
    void
    setTypeParameters(String[] typeParameters)
    Deprecated.
    Sets the formal type parameters for this method.

    Methods inherited from interface IDOMMember

    getComment, getFlags, setComment, setFlags
    Modifier and Type
    Method
    Description
    Deprecated.
    Returns the comment associated with this member (including comment delimiters).
    int
    Deprecated.
    Returns the flags for this member.
    void
    setComment(String comment)
    Deprecated.
    Sets the comment associated with this member.
    void
    setFlags(int flags)
    Deprecated.
    Sets the flags for this member.

    Methods inherited from interface IDOMNode

    addChild, canHaveChildren, clone, getCharacters, getChild, getChildren, getContents, getFirstChild, getJavaElement, getNextNode, getNodeType, getParent, getPreviousNode, insertSibling, isAllowableChild, isSignatureEqual, remove
    Modifier and Type
    Method
    Description
    void
    Deprecated.
    Adds the given un-parented node (document fragment) as the last child of this node.
    boolean
    Deprecated.
    Returns whether this node is allowed to have children.
    Deprecated.
    Returns a stand-alone copy of the document fragment represented by this node that is in no way dependent on the document this node is part of.
    char[]
    Deprecated.
    Returns the current contents of this document fragment as a character array.
    Deprecated.
    Returns the first named child of this node with the given name.
    Deprecated.
    Returns an enumeration of children of this node.
    Deprecated.
    Returns the current contents of this document fragment.
    Deprecated.
    Returns the first child of this node.
    Deprecated.
    Returns a handle for the Java element associated with this document fragment, based on the parent Java element.
    Deprecated.
    Returns the sibling node immediately following this node.
    int
    Deprecated.
    Returns the type of this node.
    Deprecated.
    Returns the parent of this node.
    Deprecated.
    Returns the sibling node immediately preceding this node.
    void
    Deprecated.
    Inserts the given un-parented node as a sibling of this node, immediately before this node.
    boolean
    Deprecated.
    Returns whether the given node is an allowable child for this node.
    boolean
    Deprecated.
    Returns whether this node's signature is equivalent to the given node's signature.
    void
    Deprecated.
    Separates this node from its parent and siblings, maintaining any ties that this node has to the underlying document fragment.
  • Method Details

    • addException

      void addException(String exceptionType) throws IllegalArgumentException
      Deprecated.
      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
      Throws:
      IllegalArgumentException - if null is specified
      See Also:
    • addParameter

      void addParameter(String type, String name) throws IllegalArgumentException
      Deprecated.
      Adds the given parameter to the end of the parameter list. This is a convenience method for 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[]".
      Parameters:
      type - the type name
      name - the parameter name
      Throws:
      IllegalArgumentException - if null is specified for either the type or the name
      See Also:
    • getBody

      String getBody()
      Deprecated.
      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)
    • setDefault

      void setDefault(String defaultValue)
      Deprecated.
      Sets the default value expression for an annotation type member.
      Parameters:
      defaultValue - the default value expression, or null indicating the member does not have a default value
      Since:
      3.0
    • getDefault

      String getDefault()
      Deprecated.
      Returns the default value expression for an annotation type member.
      Returns:
      the default value expression, or null indicating the member does not have a default value
      Since:
      3.0
    • getExceptions

      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. 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".
      Returns:
      the list of exception types
    • getTypeParameters

      String[] getTypeParameters()
      Deprecated.
      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, an empty array if none
      Since:
      3.0
    • getName

      String getName()
      Deprecated.
      The 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).
      Specified by:
      getName in interface IDOMNode
      Returns:
      the name of this method or null for constructors
    • getParameterNames

      String[] getParameterNames()
      Deprecated.
      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).
      Returns:
      the list of parameter names, or null if no parameters are declared
    • getParameterTypes

      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. 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 parameter types, or null if no parameters are declared
    • getReturnType

      String getReturnType()
      Deprecated.
      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
    • isConstructor

      boolean isConstructor()
      Deprecated.
      Returns whether this method is a constructor.
      Returns:
      true for constructors, and false for methods
    • setBody

      void setBody(String body)
      Deprecated.
      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)
    • setConstructor

      void setConstructor(boolean b)
      Deprecated.
      Sets whether this method represents a constructor.
      Parameters:
      b - true for constructors, and false for methods
    • setExceptions

      void setExceptions(String[] exceptionTypes)
      Deprecated.
      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
    • setTypeParameters

      void setTypeParameters(String[] typeParameters)
      Deprecated.
      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> & Serializable".

      Parameters:
      typeParameters - the formal type parameters of this method, in the order to appear in the source, an empty array if none
      Since:
      3.0
    • setName

      void setName(String name) throws IllegalArgumentException
      Deprecated.
      The 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.

      Specified by:
      setName in interface IDOMNode
      Parameters:
      name - the given name
      Throws:
      IllegalArgumentException - if null is specified
    • setParameters

      void setParameters(String[] types, String[] names) throws IllegalArgumentException
      Deprecated.
      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[]".
      Parameters:
      types - the list of type names
      names - the list of parameter name
      Throws:
      IllegalArgumentException - if the number of types and names do not match, or if either argument is null
    • setReturnType

      void setReturnType(String type) throws IllegalArgumentException
      Deprecated.
      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
      Throws:
      IllegalArgumentException - if null is specified