gr.uoa.di.madgik.execution.datatype
Class DataTypeConvertable

java.lang.Object
  extended by gr.uoa.di.madgik.execution.datatype.DataTypeConvertable
All Implemented Interfaces:
IDataType, Serializable

public class DataTypeConvertable
extends Object
implements IDataType

This class represents data type with an object that can be converted using an IObjectConverter instance

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface gr.uoa.di.madgik.execution.datatype.IDataType
IDataType.DataTypes
 
Constructor Summary
DataTypeConvertable()
           
 
Method Summary
 boolean CanSuggestDataTypeClass()
          Always returns false
 void FromXML(Element XML)
          Parses the xml serialization of the data type as retrieved by IDataType.ToXML()
 void FromXML(String XML)
          Parses the xml serialization of the data type as retrieved by IDataType.ToXML()
 String GetConvertedValue()
          Gets the string representation of the value
 String GetConverter()
          Gets the converter class name
 Class<?> GetDataTypeClass()
          Returns null
 IDataType.DataTypes GetDataTypeEnum()
          Returns IDataType.DataTypes.Convertable
 String GetStringValue()
          if the value is null, an empty string is returned.
 Object GetValue()
          this instance is returned
 void SetConvertedValue(String ConvertedValue)
          Sets the string representation of the value
 void SetConverter(String Converter)
          Sets the converter class name
 void SetStringValue(String val)
          If the value is null or an empty string, null is set.
 void SetValue(Object Value)
          If the provided value is null, the string representation of the converted value is set to null.
 String ToXML()
          Creates an xml serialization of the data type
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataTypeConvertable

public DataTypeConvertable()
Method Detail

CanSuggestDataTypeClass

public boolean CanSuggestDataTypeClass()
Always returns false

Specified by:
CanSuggestDataTypeClass in interface IDataType
Returns:
true, if it can
See Also:
IDataType.CanSuggestDataTypeClass()

GetDataTypeClass

public Class<?> GetDataTypeClass()
Returns null

Specified by:
GetDataTypeClass in interface IDataType
Returns:
the run time type
See Also:
IDataType.GetDataTypeClass()

GetDataTypeEnum

public IDataType.DataTypes GetDataTypeEnum()
Returns IDataType.DataTypes.Convertable

Specified by:
GetDataTypeEnum in interface IDataType
Returns:
the data type
See Also:
IDataType.GetDataTypeEnum()

GetStringValue

public String GetStringValue()
                      throws ExecutionSerializationException
if the value is null, an empty string is returned. Otherwise the string representation of the value is returned

Specified by:
GetStringValue in interface IDataType
Returns:
the string representation of the value
Throws:
ExecutionSerializationException - A serialization error occurred
See Also:
IDataType.GetStringValue()

GetValue

public Object GetValue()
this instance is returned

Specified by:
GetValue in interface IDataType
Returns:
the value
See Also:
IDataType.GetValue()

GetConvertedValue

public String GetConvertedValue()
Gets the string representation of the value

Returns:
the string representation

SetConvertedValue

public void SetConvertedValue(String ConvertedValue)
Sets the string representation of the value

Parameters:
ConvertedValue - the string representation of the value

GetConverter

public String GetConverter()
Gets the converter class name

Returns:
the converter class name

SetConverter

public void SetConverter(String Converter)
Sets the converter class name

Parameters:
Converter - the converter class name

SetStringValue

public void SetStringValue(String val)
                    throws ExecutionValidationException,
                           ExecutionSerializationException
If the value is null or an empty string, null is set. Otherwise a call to IDataType.SetValue(Object) is made

Specified by:
SetStringValue in interface IDataType
Parameters:
val - the value to set
Throws:
ExecutionValidationException - A validation error occurred
ExecutionSerializationException - A serialization error occurred
See Also:
IDataType.SetStringValue(java.lang.String)

SetValue

public void SetValue(Object Value)
              throws ExecutionValidationException
If the provided value is null, the string representation of the converted value is set to null. Otherwise, if the value is an instance of DataTypeConvertable, the string representation of the converted value and the converter class name are set to the respective values of the argument. Else if the argument is a string, the string representation of the converted value is set to the argument. Otherwise, if the converter class is set, an instance of that class is initialized and the provided argument is provided to the IObjectConverter.Convert(Object) and the returned string is set as the string representation of the convertable.

Specified by:
SetValue in interface IDataType
Parameters:
Value - the value to set
Throws:
ExecutionValidationException - A validation error occurred
See Also:
IDataType.SetValue(java.lang.Object)

FromXML

public void FromXML(String XML)
             throws ExecutionSerializationException
Description copied from interface: IDataType
Parses the xml serialization of the data type as retrieved by IDataType.ToXML()

Specified by:
FromXML in interface IDataType
Parameters:
XML - the XML serialization
Throws:
ExecutionSerializationException - A serialization error occurred

FromXML

public void FromXML(Element XML)
             throws ExecutionSerializationException
Description copied from interface: IDataType
Parses the xml serialization of the data type as retrieved by IDataType.ToXML()

Specified by:
FromXML in interface IDataType
Parameters:
XML - The root element of the serialization
Throws:
ExecutionSerializationException - A validation error occurred

ToXML

public String ToXML()
             throws ExecutionSerializationException
Description copied from interface: IDataType
Creates an xml serialization of the data type

Specified by:
ToXML in interface IDataType
Returns:
the XML serialization
Throws:
ExecutionSerializationException - a serialization error occurred


Copyright © 2013. All Rights Reserved.