org.jtool.jxplatform.wrapper
Class JxMethod

java.lang.Object
  extended byorg.jtool.jxplatform.wrapper.JxElement
      extended byorg.jtool.jxplatform.wrapper.JxMethod
Direct Known Subclasses:
JxBinaryMethod

public class JxMethod
extends JxElement

An object wrapping the Method or Ctor element.

Author:
Katsuhisa Maruyama

Field Summary
protected  org.w3c.dom.Element[] faccessElems
          Elements of field accesses within in this method.
protected  java.lang.String fqn
          The fully-qualified name of this method.
protected  org.w3c.dom.Element[] innerclassElems
          Elements of inThner classes within in this method.
protected  org.w3c.dom.Element[] localElems
          Elements of local variables defined in this method.
protected  org.w3c.dom.Element[] mcallElems
          Elements of method calls within in this method.
protected  java.lang.String name
          The name of this method.
protected  org.w3c.dom.Element[] parameterElems
          Elements of parameters defined in this method.
protected  java.lang.String signature
          The signature of this method.
protected  org.w3c.dom.Element[] throwElems
          Elements of exceptions this method might throw.
protected  java.lang.String type
          The type of this method.
protected  org.w3c.dom.Element[] vaccessElems
          Elements of variable accesses within in this method.
 
Fields inherited from class org.jtool.jxplatform.wrapper.JxElement
element
 
Constructor Summary
protected JxMethod()
          Creates a new, empty object.
protected JxMethod(org.w3c.dom.Element elem)
          Creates a new object wrapping a Method or Ctor element.
 
Method Summary
 boolean enclose(org.w3c.dom.Element elem)
          Tests if this method element encloses a given element.
 boolean equals(JxMethod jmethod)
          Tests if a given method wrapper equals to this one.
 java.lang.String getAccess()
          Returns the access setting for this method.
 org.w3c.dom.Element[] getAllFieldAccessElements()
          Returns elements of field accesses contained in this method.
 org.w3c.dom.Element[] getAllInnerClassElements()
          Returns elements of inner classes contained in this method.
 org.w3c.dom.Element[] getAllLocalElements()
          Returns the elements of all local variable declarations contained in this method.
 org.w3c.dom.Element[] getAllMethodCallElements()
          Returns elements of method calls contained in this method.
 org.w3c.dom.Element[] getAllParameterElements()
          Returns the elements of all parameter declarations contained in this method.
 org.w3c.dom.Element[] getAllStatementElements()
          Returns elements of statements contained in this method.
 org.w3c.dom.Element[] getAllThrowElements()
          Returns the elements of exceptions will be thrown.
 org.w3c.dom.Element[] getAllVariableAccessElements()
          Returns elements of variable accesses contained in this method.
 JxVariableList getDefinedJxVariables()
          Returns variable accesses the value of which is defined in this method.
 JxClass getJxClass()
          Obtains a class wrapper defining this method.
 JxVariableList getJxVariables()
          Returns variable appearing in this method.
static org.w3c.dom.Element getMethodElement(org.w3c.dom.Element elem)
          Returns the Method or Ctor element containing a given element.
 java.lang.String getModifier()
          Returns modifiers of this method.
 java.lang.String getName()
          Returns the name of this method.
 org.w3c.dom.Element getNameNode()
          Returns the name element of this method.
 int getNumOfParameters()
          Returns the number of parameters of this method.
 JxParameter getParameter(int index)
          Returns the parameter at the specified position.
 JxParameter getParameter(java.lang.String name)
          Returns the element for a parameter with a given name.
 org.w3c.dom.Element getParameterById(java.lang.String id)
          Returns the element for a parameter with a given identifier.
 java.lang.String getParameterTypes()
          Returns the types of all parameters of this method.
 java.lang.String getSignature()
          Returns the signature of this method.
 java.lang.String[] getThrowTypes()
          Returns the types of all exceptions thrown by this method.
 java.lang.String getTypeFqn()
          Returns the fully qualified name of the return type of this method.
 java.lang.String getTypeName()
          Returns the name of the return type of this method.
 JxVariableList getUsedJxVariables()
          Returns variable accesses the value of which is used in this method.
 int indexOf(JxParameter jp)
          Returns the position of the specified parameter in parameters of this method.
 boolean isAbstract()
          Test if this method is abstract.
static boolean isConstructor(org.w3c.dom.Element elem)
          Tests if a given element equals to Ctor.
 boolean isDefault()
          Test if the access setting of this method is default.
 boolean isFinal()
          Test if this method is final.
static boolean isMethod(org.w3c.dom.Element elem)
          Tests if a given element equals to Method.
static boolean isMethodOrConstructor(org.w3c.dom.Element elem)
          Tests if a given element equals to Method or Ctor.
 boolean isNative()
          Test if this method is native.
 boolean isPrivate()
          Test if the access setting of this method is private.
 boolean isProtected()
          Test if the access setting of this method is protected.
 boolean isPublic()
          Test if the access setting of this method is public.
 boolean isStatic()
          Test if this method is static.
 boolean isStrictfp()
          Test if this method is strictfp.
 boolean isSynchronized()
          Test if this method is synchronized.
 boolean isVoid()
          Tests if the type of this method is void.
 void print()
          Displays information about this method wrapper for debugging.
 boolean throwsException()
          Tests if this method might throw an exception.
 
Methods inherited from class org.jtool.jxplatform.wrapper.JxElement
equals, existInTheSameClass, existInTheSameField, existInTheSameFile, existInTheSameMethod, existsInTheSameClass, existsInTheSameFile, existsInTheSameMethod, existsInTheSamePackage, getArrayOfElements, getChildElement, getChildElement, getChildElements, getChildElements, getChildNodes, getChildNodes, getClassElement, getDescendantElements, getDescendantElements, getDescendantElements, getDescendantElements, getElement, getElementById, getExpressionElements, getFieldElement, getFileElement, getFirstChildElement, getFirstChildElement, getId, getId, getIdentName, getIdentName, getJxField, getJxFile, getJxMethod, getJxStaticInit, getKeyword, getLine, getMethodElement, getStatementElement, getStaticInitElement, getTypeElement, getTypeElements, indexOf, indexOf, isBinary, isClass, isClassOrInterface, isConstructor, isExpression, isField, isFile, isImport, isInterface, isInTheSameField, isLocal, isMethod, isMethodOrConstructor, isPackage, isParameter, isStatement, isStaticInit, isTerminalElement, isType, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name

protected java.lang.String name
The name of this method.


signature

protected java.lang.String signature
The signature of this method.


fqn

protected java.lang.String fqn
The fully-qualified name of this method.


type

protected java.lang.String type
The type of this method.


parameterElems

protected org.w3c.dom.Element[] parameterElems
Elements of parameters defined in this method.


localElems

protected org.w3c.dom.Element[] localElems
Elements of local variables defined in this method.


throwElems

protected org.w3c.dom.Element[] throwElems
Elements of exceptions this method might throw.


mcallElems

protected org.w3c.dom.Element[] mcallElems
Elements of method calls within in this method.


faccessElems

protected org.w3c.dom.Element[] faccessElems
Elements of field accesses within in this method.


vaccessElems

protected org.w3c.dom.Element[] vaccessElems
Elements of variable accesses within in this method.


innerclassElems

protected org.w3c.dom.Element[] innerclassElems
Elements of inThner classes within in this method.

Constructor Detail

JxMethod

protected JxMethod()
Creates a new, empty object.


JxMethod

protected JxMethod(org.w3c.dom.Element elem)
            throws JxWrapperException
Creates a new object wrapping a Method or Ctor element.

Parameters:
elem - An DOM element to be wrapped.
Throws:
JxWrapperException - if the specified element is not valid.
Method Detail

getName

public java.lang.String getName()
Returns the name of this method.

Returns:
The name string.

getNameNode

public org.w3c.dom.Element getNameNode()
Returns the name element of this method.

Returns:
The element indicating the method name.

getTypeFqn

public java.lang.String getTypeFqn()
Returns the fully qualified name of the return type of this method.

Returns:
The fully-qualified name string.

getTypeName

public java.lang.String getTypeName()
Returns the name of the return type of this method.

Overrides:
getTypeName in class JxElement
Returns:
The return type string.

getAccess

public java.lang.String getAccess()
Returns the access setting for this method.

Returns:
The string of the access setting (Public, Protected, Private, or Default).

getJxClass

public JxClass getJxClass()
Obtains a class wrapper defining this method.

Overrides:
getJxClass in class JxElement
Returns:
The JavaClass wrapper defining this method.

isMethod

public static boolean isMethod(org.w3c.dom.Element elem)
Tests if a given element equals to Method.

Parameters:
elem - An element of the DOM.
Returns:
if the element equals to Method.

isConstructor

public static boolean isConstructor(org.w3c.dom.Element elem)
Tests if a given element equals to Ctor.

Parameters:
elem - An element of the DOM.
Returns:
if the element equals to Ctor.

isMethodOrConstructor

public static boolean isMethodOrConstructor(org.w3c.dom.Element elem)
Tests if a given element equals to Method or Ctor.

Parameters:
elem - An element of the DOM.
Returns:
if the element equals to Method or Ctor.

getMethodElement

public static org.w3c.dom.Element getMethodElement(org.w3c.dom.Element elem)
Returns the Method or Ctor element containing a given element.

Parameters:
elem - An element of the DOM.
Returns:
The Method or Ctor element, or null if thereis no such element.

equals

public boolean equals(JxMethod jmethod)
Tests if a given method wrapper equals to this one.

Parameters:
jmethod - A method wrapper.
Returns:
true if the method wrapper equals to this one, otherwise false.

enclose

public boolean enclose(org.w3c.dom.Element elem)
Tests if this method element encloses a given element.

Parameters:
elem - An element of the DOM.
Returns:
true if this element encloses the element.

getAllParameterElements

public org.w3c.dom.Element[] getAllParameterElements()
Returns the elements of all parameter declarations contained in this method.

Returns:
The array of the Param elements.

getAllLocalElements

public org.w3c.dom.Element[] getAllLocalElements()
Returns the elements of all local variable declarations contained in this method.

Returns:
The array of the Local elements.

getAllThrowElements

public org.w3c.dom.Element[] getAllThrowElements()
Returns the elements of exceptions will be thrown.

Returns:
The array of the ThrwOpt elements.

getSignature

public java.lang.String getSignature()
Returns the signature of this method.

Returns:
The string of the method signature.

getParameterTypes

public java.lang.String getParameterTypes()
Returns the types of all parameters of this method.

Returns:
The string including the fully qualified name of the parameter types, or null.

getNumOfParameters

public int getNumOfParameters()
Returns the number of parameters of this method.

Returns:
The number of paramethers.

getParameter

public JxParameter getParameter(int index)
Returns the parameter at the specified position.

Parameters:
index - The position of the specified parameter.
Returns:
The DOM element, null if there is no element found.

getParameter

public JxParameter getParameter(java.lang.String name)
Returns the element for a parameter with a given name.

Parameters:
name - The name of a parameter to be retrieved.
Returns:
The matched DOM element, null if there is no element found.

getParameterById

public org.w3c.dom.Element getParameterById(java.lang.String id)
Returns the element for a parameter with a given identifier.

Parameters:
id - The identifier of a parameter to be retrieved.
Returns:
The matched DOM element, null if there is no element found.

indexOf

public int indexOf(JxParameter jp)
Returns the position of the specified parameter in parameters of this method.

Parameters:
jp - A parameter wrapper.
Returns:
The index of the specified parameter, -1 if there is no parameter found.

throwsException

public boolean throwsException()
Tests if this method might throw an exception.

Returns:
true if this method might throw an exception.

getThrowTypes

public java.lang.String[] getThrowTypes()
Returns the types of all exceptions thrown by this method.

Returns:
The array of the fully-qualified name of the exception types.

isVoid

public boolean isVoid()
Tests if the type of this method is void.

Returns:
true if the type of this method is void.

isPublic

public boolean isPublic()
Test if the access setting of this method is public.

Returns:
true if this method is public.

isProtected

public boolean isProtected()
Test if the access setting of this method is protected.

Returns:
true if this method is protected.

isPrivate

public boolean isPrivate()
Test if the access setting of this method is private.

Returns:
true if this method is private.

isDefault

public boolean isDefault()
Test if the access setting of this method is default.

Returns:
true if this method has no specified access setting.

isFinal

public boolean isFinal()
Test if this method is final.

Returns:
true if this method is final.

isAbstract

public boolean isAbstract()
Test if this method is abstract.

Returns:
true if this method is abstract.

isStatic

public boolean isStatic()
Test if this method is static.

Returns:
true if this method is static.

isSynchronized

public boolean isSynchronized()
Test if this method is synchronized.

Returns:
true if this method is synchronized.

isNative

public boolean isNative()
Test if this method is native.

Returns:
true if this method is native.

isStrictfp

public boolean isStrictfp()
Test if this method is strictfp.

Returns:
true if this class is strictfp.

getModifier

public java.lang.String getModifier()
Returns modifiers of this method.

Returns:
The canonical string of modifiers.

getAllStatementElements

public org.w3c.dom.Element[] getAllStatementElements()
Returns elements of statements contained in this method.

Returns:
The elements of statements.

getAllMethodCallElements

public org.w3c.dom.Element[] getAllMethodCallElements()
Returns elements of method calls contained in this method.

Returns:
The elements of method calls.

getAllFieldAccessElements

public org.w3c.dom.Element[] getAllFieldAccessElements()
Returns elements of field accesses contained in this method.

Returns:
The elememts of field accesses.

getAllVariableAccessElements

public org.w3c.dom.Element[] getAllVariableAccessElements()
Returns elements of variable accesses contained in this method.

Returns:
The elememts of variable accesses.

getDefinedJxVariables

public JxVariableList getDefinedJxVariables()
                                     throws JxWrapperException
Returns variable accesses the value of which is defined in this method.

Returns:
A collection of JxVariable.
Throws:
JxWrapperException - if the creation of a variable access wrapper fails.

getUsedJxVariables

public JxVariableList getUsedJxVariables()
                                  throws JxWrapperException
Returns variable accesses the value of which is used in this method.

Returns:
A collection of JxVariable.
Throws:
JxWrapperException - if the creation of a variable access wrapper fails.

getJxVariables

public JxVariableList getJxVariables()
                              throws JxWrapperException
Returns variable appearing in this method.

Returns:
A collection of JxVariable.
Throws:
JxWrapperException - if the creation of a wrapper fails.

getAllInnerClassElements

public org.w3c.dom.Element[] getAllInnerClassElements()
Returns elements of inner classes contained in this method.

Returns:
The elememts of inner classes.

print

public void print()
Displays information about this method wrapper for debugging.