Style Intelligence v12.0

inetsoft.uql.schema
Class XTypeNode

java.lang.Object
  extended by inetsoft.uql.XNode
      extended by inetsoft.uql.schema.XTypeNode
All Implemented Interfaces:
inetsoft.util.XMLSerializable, Serializable, Cloneable, Comparable
Direct Known Subclasses:
BooleanType, CharacterType, DateBaseType, NumberBaseType, RoleType, StringType, TextOutput, UserDefinedType, UserType

public class XTypeNode
extends XNode
implements Comparable, inetsoft.util.XMLSerializable

A XTypeNode is a type definition. It can be one of the primitive types as defined in the XSchema class. Or it can be a complex type that is composed of children of other types.

See Also:
Serialized Form

Field Summary
static int STAR
          Specify '*' in the maxOccurs.
 
Fields inherited from class inetsoft.uql.XNode
value
 
Constructor Summary
XTypeNode()
          Create a type node.
XTypeNode(String name)
          Create a type node.
 
Method Summary
 void addAttribute(XTypeNode attr)
          Add an attribute to the type.
 void addChild(XNode child, boolean sorted)
          Add a child to this node.
 Object clone()
          Clone the object.
 XTypeNode clone(String type)
          Create a primitive type node.
 XTypeNode cloneType()
          Clone a an output (XTypeNode) node of a datasource.
 int compareTo(Object obj)
          Compare to another object.
 boolean equals(Object obj)
          Check if two types are identical.
 XTypeNode getAttribute(int idx)
          Get the specified attribute.
 int getAttributeCount()
          Get the number of attributes in this type.
 int getAttributeIndex(XTypeNode attr)
          Get the index of an attribute.
protected  String getAttributeString()
          Get additional attributes string.
 XTypeNode getAttributeType(String name)
          Get the attribute type node with specified name.
 String getFormat()
          Get the format string of this data type.
 int getMaxOccurs()
          Get the maximum number of instances allowed for this element.
 int getMinOccurs()
          Get the minimum number of instances allowed for this element.
 String getType()
          Get the type of this node.
 XTypeNode getTypeNode(String path)
          Find the type node specified by the node path.
 XMetaInfo getXMetaInfo()
          Get the meta info.
 boolean isCompatible(XTypeNode type)
          Check if two types are compatible.
 boolean isDate()
          Check if this type is a date or time.
 boolean isNumber()
          Check if this type is a numeric type.
 boolean isPrimitive()
          Return true if this is a primitive type.
 boolean isTypeNodeExists(XTypeNode tp)
          Check if typenode tp is a child node of this type node.
 XNode newInstance()
          Create a value tree corresponding to the data type defined by this type.
 XNode newInstance(boolean children)
          Create a value tree corresponding to the data type defined by this type.
 void parseXML(Element root)
          Parse the XML element that contains information on this data source.
 void setAttribute(int index, XTypeNode attr)
          Set an attribute at an index.
 void setFormat(String fmt)
          Set the format string for the type.
 void setMaxOccurs(int max)
          Set the maximum number of instances allowed for this element.
 void setMinOccurs(int min)
          Set the minimum number of instances allowed for this element.
 void setXMetaInfo(XMetaInfo minfo)
          Set the meta info.
 String toString()
          Get the string representation.
protected  void writeAttributes(PrintWriter writer)
          Write the min/max occurs attributes.
 void writeTreeXML(PrintWriter writer)
          Write this type and all types referenced by this type to XML.
 void writeTypeXML(PrintWriter writer)
          Write the XML schema specification.
 void writeXML(PrintWriter writer)
          Write the XML schema specification.
 
Methods inherited from class inetsoft.uql.XNode
addChild, addChild, addr, checkDuplicate, cloneValue, eq, getAttribute, getAttributeNames, getChild, getChild, getChildCount, getChildIndex, getDefaultFormat, getName, getNode, getParent, getPath, getPath, getValue, getValue, hashCode, insertChild, isAncestor, removeAllChildren, removeChild, removeChild, removeChild, removeChild, setAttribute, setChild, setDefaultFormat, setName, setValue, sort, sort
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

STAR

public static final int STAR
Specify '*' in the maxOccurs.

See Also:
Constant Field Values
Constructor Detail

XTypeNode

public XTypeNode()
Create a type node.


XTypeNode

public XTypeNode(String name)
Create a type node.

Method Detail

getTypeNode

public XTypeNode getTypeNode(String path)
Find the type node specified by the node path. The node path is the path of the node in a value tree. The type of the tree is defined by this XTypeNode.


addAttribute

public void addAttribute(XTypeNode attr)
Add an attribute to the type.


setAttribute

public void setAttribute(int index,
                         XTypeNode attr)
Set an attribute at an index.

Parameters:
index - the specified index
attr - the specified attribute

getAttributeCount

public int getAttributeCount()
Get the number of attributes in this type.


getAttribute

public XTypeNode getAttribute(int idx)
Get the specified attribute.


getAttributeIndex

public int getAttributeIndex(XTypeNode attr)
Get the index of an attribute.

Parameters:
attr - the specified attribute
Returns:
the index of the specified attribute

getXMetaInfo

public XMetaInfo getXMetaInfo()
Get the meta info.


setXMetaInfo

public void setXMetaInfo(XMetaInfo minfo)
Set the meta info.


getAttributeType

public XTypeNode getAttributeType(String name)
Get the attribute type node with specified name.


setMinOccurs

public void setMinOccurs(int min)
Set the minimum number of instances allowed for this element.


getMinOccurs

public int getMinOccurs()
Get the minimum number of instances allowed for this element.


setMaxOccurs

public void setMaxOccurs(int max)
Set the maximum number of instances allowed for this element.


getMaxOccurs

public int getMaxOccurs()
Get the maximum number of instances allowed for this element.


addChild

public void addChild(XNode child,
                     boolean sorted)
Add a child to this node.

Overrides:
addChild in class XNode
Parameters:
child - child node.
sorted - true to add child in sorted order.

newInstance

public XNode newInstance()
Create a value tree corresponding to the data type defined by this type.


newInstance

public XNode newInstance(boolean children)
Create a value tree corresponding to the data type defined by this type.

Parameters:
children - true if tree should be created with children

isPrimitive

public boolean isPrimitive()
Return true if this is a primitive type.


isNumber

public boolean isNumber()
Check if this type is a numeric type.


isDate

public boolean isDate()
Check if this type is a date or time.


isCompatible

public boolean isCompatible(XTypeNode type)
Check if two types are compatible. If two types are compatible, the values of one value node can be assigned to the value of another value node.


writeTreeXML

public void writeTreeXML(PrintWriter writer)
Write this type and all types referenced by this type to XML.


isTypeNodeExists

public boolean isTypeNodeExists(XTypeNode tp)
Check if typenode tp is a child node of this type node.


parseXML

public void parseXML(Element root)
Parse the XML element that contains information on this data source.

Specified by:
parseXML in interface inetsoft.util.XMLSerializable

writeTypeXML

public void writeTypeXML(PrintWriter writer)
Write the XML schema specification.


writeXML

public void writeXML(PrintWriter writer)
Write the XML schema specification.

Specified by:
writeXML in interface inetsoft.util.XMLSerializable
Overrides:
writeXML in class XNode

writeAttributes

protected void writeAttributes(PrintWriter writer)
Write the min/max occurs attributes.


getAttributeString

protected String getAttributeString()
Get additional attributes string.


getType

public String getType()
Get the type of this node. The types are defined in XSchema class.


setFormat

public void setFormat(String fmt)
Set the format string for the type. The meaning of the format depends on the data type. For example, for date related formats, the format string is used to construct a SimpleDateFormat object.


getFormat

public String getFormat()
Get the format string of this data type.


toString

public String toString()
Get the string representation.

Overrides:
toString in class XNode

compareTo

public int compareTo(Object obj)
Compare to another object.

Specified by:
compareTo in interface Comparable
Overrides:
compareTo in class XNode
Parameters:
obj - the object with which to compare.
Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

cloneType

public XTypeNode cloneType()
                    throws Exception
Clone a an output (XTypeNode) node of a datasource. The type node is cloned by writing the type to XML and parse it back to handle recursive type dependency.

Throws:
Exception

clone

public Object clone()
Clone the object.

Overrides:
clone in class XNode

clone

public XTypeNode clone(String type)
Create a primitive type node.

Parameters:
type - one of the primitive types defined in XSchema.

equals

public boolean equals(Object obj)
Check if two types are identical.

Overrides:
equals in class XNode

Copyright © 1996-2014 InetSoft Technology Corp. All Rights Reserved.