org.jtool.jxplatform.wrapper
Class JxType

java.lang.Object
  extended byorg.jtool.jxplatform.wrapper.JxElement
      extended byorg.jtool.jxplatform.wrapper.JxType

public class JxType
extends JxElement

An object wrapping the Type element.

Author:
Katsuhisa Maruyama

Field Summary
protected  java.lang.String fqn
          The fully-qualified name of this type.
protected  java.lang.String name
          The name of this type.
protected  org.w3c.dom.Element simpleTypeElem
          An element corresponding to the simple type.
protected  java.lang.String sort
          The sort of this type.
 
Fields inherited from class org.jtool.jxplatform.wrapper.JxElement
element
 
Constructor Summary
protected JxType()
          Creates a new, empty object.
protected JxType(org.w3c.dom.Element elem)
          Creates a new object wrapping a Type element.
 
Method Summary
 boolean equals(JxType jtype)
          Tests if a given type wrapper equals to this one.
 java.lang.String getFqn()
          Returns the fully-qualified name of this type.
static java.lang.String getLiteralType(java.lang.String sort)
          Returns the type of the kind of a literal element.
 java.lang.String getName()
          Returns the name of this type.
static java.lang.String getPrimitiveTypeInWidening(java.lang.String type1, java.lang.String type2)
          Returns the type after wideing conversion of given two types.
 JxClass getReferencedJxClass()
          Returns the class wrapper referenced by this type.
 java.lang.String getSimpleFqn()
          Returns the simple fully-qualified name of this type.
 java.lang.String getSimpleName()
          Returns the simple name of this type.
static java.lang.String getTypeInWidening(java.lang.String type1, java.lang.String type2)
          Returns the type after wideing conversion of given two types.
 boolean isChildOfDotExpression()
          Tests if this type element is enclosed by a dot expression.
 boolean isObjectRef()
          Tests if this type is a non-primitive one or a non0primitive array.
 boolean isPrimitive()
          Tests if this type is a primitive one or a primitive array.
static boolean isPrimitiveType(java.lang.String type)
          Tests if the type is primitive.
static boolean isType(org.w3c.dom.Element elem)
          Tests if a given element equals to Type.
 void print()
          Displays information about this type 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, getJxFile, 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 type.


fqn

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


sort

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


simpleTypeElem

protected org.w3c.dom.Element simpleTypeElem
An element corresponding to the simple type.

Constructor Detail

JxType

protected JxType()
Creates a new, empty object.


JxType

protected JxType(org.w3c.dom.Element elem)
          throws JxWrapperException
Creates a new object wrapping a Type element.

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

isPrimitive

public boolean isPrimitive()
Tests if this type is a primitive one or a primitive array.

Returns:
true if this type is a primitive one or a primitive array.

isObjectRef

public boolean isObjectRef()
Tests if this type is a non-primitive one or a non0primitive array.

Returns:
true if this type is a non-primitive one or a non0primitive array.

getSimpleName

public java.lang.String getSimpleName()
Returns the simple name of this type.

Returns:
The simple name string not including the array symbols.

getName

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

Returns:
The type name string.

getSimpleFqn

public java.lang.String getSimpleFqn()
Returns the simple fully-qualified name of this type.

Returns:
The simple fully-qualified name string including the array symbols.

getFqn

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

Returns:
The fully-qualified name string.

getReferencedJxClass

public JxClass getReferencedJxClass()
                             throws JxWrapperException
Returns the class wrapper referenced by this type.

Returns:
The JxClass wrapper of the referenced class, or null if this type is primitive.
Throws:
JxWrapperException - if no class wrapper is found.
JxWrapperException

isType

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

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

isChildOfDotExpression

public boolean isChildOfDotExpression()
Tests if this type element is enclosed by a dot expression.

Returns:
true if the element is a child of a dot expression.

equals

public boolean equals(JxType jtype)
Tests if a given type wrapper equals to this one.

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

isPrimitiveType

public static boolean isPrimitiveType(java.lang.String type)
Tests if the type is primitive.

Parameters:
type - A type to be examined.
Returns:
true if the type is primitive, othwerwise false.

getLiteralType

public static java.lang.String getLiteralType(java.lang.String sort)
Returns the type of the kind of a literal element.

Parameters:
sort - The sort of a literal.
Returns:
The string of the primitive type or java.lang.String.

getTypeInWidening

public static java.lang.String getTypeInWidening(java.lang.String type1,
                                                 java.lang.String type2)
Returns the type after wideing conversion of given two types.

Parameters:
type1 - A type string.
type2 - A type string.
Returns:
The strnig of the wider type.

getPrimitiveTypeInWidening

public static java.lang.String getPrimitiveTypeInWidening(java.lang.String type1,
                                                          java.lang.String type2)
Returns the type after wideing conversion of given two types.

Parameters:
type1 - A type string.
type2 - A type string.
Returns:
The string of the wider type.

print

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