org.jtool.jxplatform.wrapper
Class JxClass

java.lang.Object
  extended byorg.jtool.jxplatform.wrapper.JxElement
      extended byorg.jtool.jxplatform.wrapper.JxClass
Direct Known Subclasses:
JxBinaryClass

public class JxClass
extends JxElement

An object wrapping the Class or Intf element.

Author:
Katsuhisa MaruyamaThe classes in the project

Field Summary
protected  boolean anonymous
          The flag if this class is anonymous.
protected  org.w3c.dom.Element[] constructorElems
          Elements of constructors defined in this class.
protected  org.w3c.dom.Element[] fieldElems
          Elements of fields defined in this class.
protected  JxFieldList fields
          Fields defined in this class.
protected  java.lang.String fqn
          The fully-qualified name of this class.
protected  org.w3c.dom.Element member
          A Members element dominated by this class.
protected  org.w3c.dom.Element[] methodElems
          Elements of methods defined in this class.
protected  JxMethodList methods
          Methods and constructors defined in this class.
protected  java.lang.String name
          The name of this class.
 
Fields inherited from class org.jtool.jxplatform.wrapper.JxElement
element
 
Constructor Summary
protected JxClass()
          Creates a new, empty object.
protected JxClass(org.w3c.dom.Element elem)
          Creates a new object wrapping a Class or Intf element.
 
Method Summary
 boolean enclose(org.w3c.dom.Element elem)
          Tests if this class element encloses a given element.
 boolean equals(JxClass jclass)
          Tests if a given class wrapper equals to this one.
 java.lang.String getAccess()
          Returns the access setting for this class.
 JxClassList getAllAncestors()
          Returns the wrapper list of the ancestors of this class.
 org.w3c.dom.Element[] getAllFieldElements()
          Returns the elements of all field declarations contained in this class.
 org.w3c.dom.Element[] getAllInnerClassElements()
          Returns all the elements of the inner classes.
 JxClassList getAllInnerClasses()
          Returns the wrapper list of all the inner classes.
 JxFieldList getAllJxFields()
          Returns the wrapper list of all fields within this file.
 JxMethodList getAllJxMethods()
          Returns the wrapper list of all methods and constructors within this file.
 org.w3c.dom.Element[] getAllMethodAndConstructorElements()
          Returns the elements of all class and interface declarations contained in this class.
 org.w3c.dom.Element[] getAllOuterClassElements()
          Returns all the elements of the outer classes.
 JxClassList getAllOuterJxClasses()
          Returns the wrapper list of all the outer classes.
 JxClassList getAllSuperclasses()
          Returns the wrapper list of all the superclasses of this class.
 JxClassList getAllSuperInterfaces()
          Returns the wrapper list of all the super interfaces of this class.
static org.w3c.dom.Element getClassElement(org.w3c.dom.Element elem)
          Returns the Class or Intf element containing a given element.
 org.w3c.dom.Element[] getConstructorElements()
          Returns the elements of all constructor declarations contained in this class.
 org.w3c.dom.Element getFirstMemeberElement()
          Returns the first method or field element of this class.
 java.lang.String getFqn()
          Returns the fully qualified name of this class.
 java.lang.String getFqnOfTopLevelClass()
          Returns the fully qualified name of the top level class of this class.
 org.w3c.dom.Element[] getInnerClassElements()
          Returns the elements of the immediately inner classes.
 JxClassList getInnerClasses()
          Returns the wrapper list of the immediately inner classes.
 JxField getJxField(java.lang.String name)
          Returns a wrapper for a field with a given name.
 org.w3c.dom.Element getJxFieldById(java.lang.String id)
          Returns the element for a field with a given identifier.
 JxFile getJxFile()
          Obtains a file wrapper defining this class.
 JxMethod getJxMethod(java.lang.String sig)
          Returns a wrapper for a method with a given signature.
 org.w3c.dom.Element getJxMethodById(java.lang.String id)
          Returns the element for a method with a given identifier.
 org.w3c.dom.Element getLastMemeberElement()
          Returns the last method or field element of this class.
 org.w3c.dom.Element[] getMethodElements()
          Returns the elements of all method declarations contained in this class.
 java.lang.String getModifier()
          Returns modifiers of this class.
 java.lang.String getName()
          Returns the name of this class.
 org.w3c.dom.Element getNameNode()
          Returns the name element of this class.
 org.w3c.dom.Element getOuterClassElement()
          Returns the element of the immediately outer class.
 JxClass getOuterJxClass()
          Returns the wrapper of the immediately outer class.
 org.w3c.dom.Element getSinitElement()
          Returns the element of a static initializer contained in this class.
 JxClass getSuperClass()
          Returns the wrapper of the superclass of this class.
 org.w3c.dom.Element getSuperClassElement()
          Returns the declaration of a superclass of this class.
 java.lang.String getSuperclassFqn()
          Returns the fully qualified name of a superclass of this class.
 java.lang.String getSuperclassName()
          Returns the name of a superclass of this class.
 org.w3c.dom.Element[] getSuperInterfaceElements()
          Returns the declarations of super interfaces of this class.
 java.lang.String[] getSuperInterfaceFqns()
          Returns the array of fully qualified names of super interfaces of this class.
 java.lang.String[] getSuperInterfaceNames()
          Returns the array of names of super interfaces of this class.
 JxClassList getSuperInterfaces()
          Returns the wrapper list of all the super interfaces of this class.
 boolean isAbstract()
          Test if this class is abstract.
 boolean isAnonymous()
          Tests if this class is the anonymous class.
 boolean isChildOf(JxClass jc)
          Test if this class is a child of the specified class.
static boolean isClass(org.w3c.dom.Element elem)
          Tests if a given element is the Class.
 boolean isDefault()
          Test if the access setting of this class is default.
 boolean isFinal()
          Test if this class is final.
 boolean isInnerClass()
          Tests if this class is an inner class.
static boolean isInterface(org.w3c.dom.Element elem)
          Tests if a given element is the Intf.
 boolean isPrivate()
          Test if the access setting of this class is private.
 boolean isProtected()
          Test if the access setting of this class is protected.
 boolean isPublic()
          Test if the access setting of this class is public.
 boolean isStatic()
          Test if this class is static.
 boolean isStrictfp()
          Test if this class is strictfp.
 void print()
          Displays information about this class wrapper for debugging.
 
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, getJxClass, getJxField, getJxMethod, getJxStaticInit, getKeyword, getLine, getMethodElement, getStatementElement, getStaticInitElement, getTypeElement, getTypeElements, getTypeName, 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 class.


fqn

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


anonymous

protected boolean anonymous
The flag if this class is anonymous.


member

protected org.w3c.dom.Element member
A Members element dominated by this class.


methodElems

protected org.w3c.dom.Element[] methodElems
Elements of methods defined in this class.


constructorElems

protected org.w3c.dom.Element[] constructorElems
Elements of constructors defined in this class.


methods

protected JxMethodList methods
Methods and constructors defined in this class.


fieldElems

protected org.w3c.dom.Element[] fieldElems
Elements of fields defined in this class.


fields

protected JxFieldList fields
Fields defined in this class.

Constructor Detail

JxClass

protected JxClass()
Creates a new, empty object.


JxClass

protected JxClass(org.w3c.dom.Element elem)
           throws JxWrapperException
Creates a new object wrapping a Class or Intf 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 class.

Returns:
The name string.

getFqn

public java.lang.String getFqn()
Returns the fully qualified name of this class.

Returns:
The fully-qualified name string.

getFqnOfTopLevelClass

public java.lang.String getFqnOfTopLevelClass()
Returns the fully qualified name of the top level class of this class.

Returns:
The fully-qualified name string.

getNameNode

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

Returns:
The element indicating the class name.

getAccess

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

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

getJxFile

public JxFile getJxFile()
Obtains a file wrapper defining this class.

Overrides:
getJxFile in class JxElement
Returns:
The JxFile wrapper defining this class.

isClass

public static boolean isClass(org.w3c.dom.Element elem)
Tests if a given element is the Class.

Parameters:
elem - An element of the DOM.
Returns:
if the element is the Class.

isInterface

public static boolean isInterface(org.w3c.dom.Element elem)
Tests if a given element is the Intf.

Parameters:
elem - An element of the DOM.
Returns:
if the element is the Intf.

getClassElement

public static org.w3c.dom.Element getClassElement(org.w3c.dom.Element elem)
Returns the Class or Intf element containing a given element.

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

isAnonymous

public boolean isAnonymous()
Tests if this class is the anonymous class.

Returns:
true if this class is the anonymous class, otherwise false.

equals

public boolean equals(JxClass jclass)
Tests if a given class wrapper equals to this one.

Parameters:
jclass - A class wrapper.
Returns:
true if the class wrapper equals to this one.

enclose

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

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

getMethodElements

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

Returns:
The array of the Method elements.

getConstructorElements

public org.w3c.dom.Element[] getConstructorElements()
Returns the elements of all constructor declarations contained in this class.

Returns:
The array of the Ctor elements.

getAllMethodAndConstructorElements

public org.w3c.dom.Element[] getAllMethodAndConstructorElements()
Returns the elements of all class and interface declarations contained in this class.

Returns:
The array of the Method and Ctor elements.

getAllJxMethods

public JxMethodList getAllJxMethods()
                             throws JxWrapperException
Returns the wrapper list of all methods and constructors within this file.

Returns:
The wrapper list of the methods and constructors.
Throws:
JxWrapperException - if creation of the method or constructor wrapper fails.

getAllFieldElements

public org.w3c.dom.Element[] getAllFieldElements()
Returns the elements of all field declarations contained in this class.

Returns:
The array of the Field elements.

getAllJxFields

public JxFieldList getAllJxFields()
                           throws JxWrapperException
Returns the wrapper list of all fields within this file.

Returns:
The wrapper list of the fields.
Throws:
JxWrapperException - if creation of the field wrapper fails.

getSinitElement

public org.w3c.dom.Element getSinitElement()
Returns the element of a static initializer contained in this class.

Returns:
The SInit element, null if there is no static initializer.

getSuperClassElement

public org.w3c.dom.Element getSuperClassElement()
Returns the declaration of a superclass of this class. In case that this class is an interface, use getSuperInterfaceElements() instead of this method.

Returns:
The element of the superclass's declaration, or null if there is no superclass or this class is an interface.

getSuperInterfaceElements

public org.w3c.dom.Element[] getSuperInterfaceElements()
Returns the declarations of super interfaces of this class.

Returns:
The element of super interface's declarations.

getSuperclassFqn

public java.lang.String getSuperclassFqn()
Returns the fully qualified name of a superclass of this class.

Returns:
The fully-qualified name string of the superclass, or null if this class has no superclass.

getSuperInterfaceFqns

public java.lang.String[] getSuperInterfaceFqns()
Returns the array of fully qualified names of super interfaces of this class.

Returns:
The string array of fully-qualified names of the super interfaces.

getSuperclassName

public java.lang.String getSuperclassName()
Returns the name of a superclass of this class.

Returns:
The name string of the superclass.

getSuperInterfaceNames

public java.lang.String[] getSuperInterfaceNames()
Returns the array of names of super interfaces of this class.

Returns:
The string array of names of the super interfaces.

isInnerClass

public boolean isInnerClass()
Tests if this class is an inner class.

Returns:
true if this class is an inner class.

getOuterClassElement

public org.w3c.dom.Element getOuterClassElement()
Returns the element of the immediately outer class.

Returns:
The element of the outer class, or null if this class has no outer class.

getAllOuterClassElements

public org.w3c.dom.Element[] getAllOuterClassElements()
Returns all the elements of the outer classes.

Returns:
The elements of the outer classes.

getInnerClassElements

public org.w3c.dom.Element[] getInnerClassElements()
                                            throws JxWrapperException
Returns the elements of the immediately inner classes.

Returns:
The elements of the inner classes.
Throws:
JxWrapperException - if

getAllInnerClassElements

public org.w3c.dom.Element[] getAllInnerClassElements()
Returns all the elements of the inner classes.

Returns:
The elements of the inner classes.

getJxMethod

public JxMethod getJxMethod(java.lang.String sig)
Returns a wrapper for a method with a given signature.

Parameters:
sig - The signature of a method to be retrived.
Returns:
The matched JxMethod wrapper, null if there is no element found.

getJxMethodById

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

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

getJxField

public JxField getJxField(java.lang.String name)
Returns a wrapper for a field with a given name.

Parameters:
name - The name of a field to be retrived.
Returns:
The matched JxField wrapper, null if there is no element found.

getJxFieldById

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

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

getFirstMemeberElement

public org.w3c.dom.Element getFirstMemeberElement()
Returns the first method or field element of this class.

Returns:
The first element.

getLastMemeberElement

public org.w3c.dom.Element getLastMemeberElement()
Returns the last method or field element of this class.

Returns:
The last element.

isChildOf

public boolean isChildOf(JxClass jc)
Test if this class is a child of the specified class.

Parameters:
jc - A class wrapper that might be superclass.
Returns:
true if this class is a child of the specified class, otherwise false.

isPublic

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

Returns:
true if this class is public.

isProtected

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

Returns:
true if this class is protected.

isPrivate

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

Returns:
true if this class is private.

isDefault

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

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

isFinal

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

Returns:
true if this class is final.

isAbstract

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

Returns:
true if this class is abstract.

isStatic

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

Returns:
true if this class is static.

isStrictfp

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

Returns:
true if this class is strictfp.

getModifier

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

Returns:
The canonical string of modifiers.

getOuterJxClass

public JxClass getOuterJxClass()
                        throws JxWrapperException
Returns the wrapper of the immediately outer class.

Returns:
The wrapper of the outer class, or null if this class has no outer class.
Throws:
JxWrapperException - if creation of the class wrapper fails.

getAllOuterJxClasses

public JxClassList getAllOuterJxClasses()
                                 throws JxWrapperException
Returns the wrapper list of all the outer classes.

Returns:
The wrapper list of the outer classes, in no particular order.
Throws:
JxWrapperException - if creation of the class wrapper fails.

getInnerClasses

public JxClassList getInnerClasses()
                            throws JxWrapperException
Returns the wrapper list of the immediately inner classes.

Returns:
The wrapper list of the inner classes.
Throws:
JxWrapperException - if creation of the class wrapper fails.

getAllInnerClasses

public JxClassList getAllInnerClasses()
                               throws JxWrapperException
Returns the wrapper list of all the inner classes.

Returns:
The wrapper list of the inner classes, in no particular order.
Throws:
JxWrapperException - if creation of the class wrapper fails.

getSuperClass

public JxClass getSuperClass()
                      throws JxWrapperException
Returns the wrapper of the superclass of this class.

Returns:
The wrapper of the superclass, or null if this class has no superclass.
Throws:
JxWrapperException - if no referenced class found.

getSuperInterfaces

public JxClassList getSuperInterfaces()
                               throws JxWrapperException
Returns the wrapper list of all the super interfaces of this class.

Returns:
The wrapper list of the super interfaces.
Throws:
JxWrapperException - if no referenced class found.

getAllAncestors

public JxClassList getAllAncestors()
                            throws JxWrapperException
Returns the wrapper list of the ancestors of this class.

Returns:
The wrapper list of the ancestors, in no particular order.
Throws:
JxWrapperException - if no referenced class found.

getAllSuperclasses

public JxClassList getAllSuperclasses()
                               throws JxWrapperException
Returns the wrapper list of all the superclasses of this class.

Returns:
The wrapper list of the superclasses, in bottom-up order.
Throws:
JxWrapperException - if no referenced class found.

getAllSuperInterfaces

public JxClassList getAllSuperInterfaces()
                                  throws JxWrapperException
Returns the wrapper list of all the super interfaces of this class.

Returns:
The wrapper list of the super interfacces, in no particular order.
Throws:
JxWrapperException - if no referenced class found.

print

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