org.shiwa.fgi.iwir
Class DataType

java.lang.Object
  extended by org.shiwa.fgi.iwir.DataType
Direct Known Subclasses:
CollectionType, SimpleType

public abstract class DataType
extends java.lang.Object

The Class DataType represents a data type. A DataType object is either an instance of a SimpleType object or CollectionType object. Data types can be defined either by constructors, for example new CollectionType(SimpleType.STRING), or by a string, for example DataType.fromString("collection/string"). The toString() method returns the string representation of the data type. Simple type is a wrapper and contains a enum concrete type. To get the real type use SimpleType.getType(). To get the nested type of a collection use CollectionType.getType().


Constructor Summary
DataType()
           
 
Method Summary
static DataType fromString(java.lang.String s)
          Returns a datatype object from a given string.
 SimpleType.ConcreteType getConcreteType()
          Returns the enum rather the wrappe as in getSimpleType() .
 int getNestingLevel()
          Gets the nesting level of a type.
 SimpleType getSimpleType()
          Gets the simple type of a data type.
 java.lang.String toString()
          Returns the string representation of the data type instance.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DataType

public DataType()
Method Detail

fromString

public static DataType fromString(java.lang.String s)
                           throws java.lang.IllegalArgumentException
Returns a datatype object from a given string.

Parameters:
s - the string to parse
Returns:
the data type
Throws:
java.lang.IllegalArgumentException - if the string can not be parsed

getSimpleType

public SimpleType getSimpleType()
Gets the simple type of a data type. Breaks the nestings and returns the simple type.

Returns:
the simple type

getConcreteType

public SimpleType.ConcreteType getConcreteType()
Returns the enum rather the wrappe as in getSimpleType() .

Returns:
the concrete type

getNestingLevel

public int getNestingLevel()
Gets the nesting level of a type. Simple types have nesting level 0.

Returns:
the nesting level

toString

public java.lang.String toString()
Returns the string representation of the data type instance.

Overrides:
toString in class java.lang.Object
Returns:
the string representation