org.apache.tuscany.sca.interfacedef.impl
Class DataTypeImpl<L>

java.lang.Object
  extended by org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl<L>
All Implemented Interfaces:
java.lang.Cloneable, DataType<L>

public class DataTypeImpl<L>
extends java.lang.Object
implements DataType<L>

Representation of the type of data associated with an operation. Data is represented in two forms: the physical form used by the runtime and a logical form used by the assembly. The physical form is a Java Type because the runtime is written in Java. This may be the same form used by the application but it may not; for example, an application that is performing stream processing may want a physical form such as an InputStream to semantially operate on application data such as a purchase order. The logical description is that used by the assembly model and is an identifier into some well-known type space; examples may be a Java type represented by its Class or an XML type represented by its QName. Every data type may also contain metadata describing the expected data; for example, it could specify a preferred data binding technology or the size of a typical instance.


Constructor Summary
DataTypeImpl(java.lang.Class<?> physical, L logical)
          Construct a data type specifying the physical and logical types.
DataTypeImpl(java.lang.String dataBinding, java.lang.Class<?> physical, L logical)
           
DataTypeImpl(java.lang.String dataBinding, java.lang.Class<?> physical, java.lang.reflect.Type genericType, L logical)
           
 
Method Summary
 java.lang.Object clone()
          Clone a data type
 boolean equals(java.lang.Object obj)
           
 java.lang.String getDataBinding()
          Get the databinding for the given data type
 java.lang.reflect.Type getGenericType()
          Get the java generic type
 L getLogical()
          Returns the logical identifier used by the assembly.
<T> T
getMetaData(java.lang.Class<T> type)
          Get the databinding-specific metadata
 java.lang.Class<?> getPhysical()
          Returns the physical type used by the runtime.
 int hashCode()
           
 void setDataBinding(java.lang.String dataBinding)
          Set the databinding for the given data type
 void setGenericType(java.lang.reflect.Type genericType)
          Set the java generic type
 void setLogical(L logical)
          Set the logical type of the data type
<T> void
setMetaData(java.lang.Class<T> type, T metaData)
          Set the databinding-specific metadata
 void setPhysical(java.lang.Class<?> physical)
          Set the java type for the data
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DataTypeImpl

public DataTypeImpl(java.lang.Class<?> physical,
                    L logical)
Construct a data type specifying the physical and logical types.

Parameters:
physical - the physical class used by the runtime
logical - the logical type
See Also:
getLogical()

DataTypeImpl

public DataTypeImpl(java.lang.String dataBinding,
                    java.lang.Class<?> physical,
                    L logical)
Parameters:
dataBinding -
physical -
logical -

DataTypeImpl

public DataTypeImpl(java.lang.String dataBinding,
                    java.lang.Class<?> physical,
                    java.lang.reflect.Type genericType,
                    L logical)
Parameters:
dataBinding -
physical -
genericType -
logical -
Method Detail

getPhysical

public java.lang.Class<?> getPhysical()
Returns the physical type used by the runtime.

Specified by:
getPhysical in interface DataType<L>
Returns:
the physical type used by the runtime

setPhysical

public void setPhysical(java.lang.Class<?> physical)
Description copied from interface: DataType
Set the java type for the data

Specified by:
setPhysical in interface DataType<L>
Parameters:
physical - the physical to set

getGenericType

public java.lang.reflect.Type getGenericType()
Get the java generic type

Specified by:
getGenericType in interface DataType<L>
Returns:
The java generic type

setGenericType

public void setGenericType(java.lang.reflect.Type genericType)
Set the java generic type

Specified by:
setGenericType in interface DataType<L>
Parameters:
genericType -

getLogical

public L getLogical()
Returns the logical identifier used by the assembly. The type of this value identifies the logical type system in use. Known values are:

Specified by:
getLogical in interface DataType<L>
Returns:
the logical type name

setLogical

public void setLogical(L logical)
Description copied from interface: DataType
Set the logical type of the data type

Specified by:
setLogical in interface DataType<L>
Parameters:
logical - the logical to set

getDataBinding

public java.lang.String getDataBinding()
Description copied from interface: DataType
Get the databinding for the given data type

Specified by:
getDataBinding in interface DataType<L>
Returns:
the databinding

setDataBinding

public void setDataBinding(java.lang.String dataBinding)
Description copied from interface: DataType
Set the databinding for the given data type

Specified by:
setDataBinding in interface DataType<L>
Parameters:
dataBinding - the dataBinding to set

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Description copied from interface: DataType
Clone a data type

Specified by:
clone in interface DataType<L>
Overrides:
clone in class java.lang.Object
Returns:
The cloned data type
Throws:
java.lang.CloneNotSupportedException

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

getMetaData

public <T> T getMetaData(java.lang.Class<T> type)
Description copied from interface: DataType
Get the databinding-specific metadata

Specified by:
getMetaData in interface DataType<L>
Parameters:
type - The java type of the metadata
Returns:
the databinding-specific metadata

setMetaData

public <T> void setMetaData(java.lang.Class<T> type,
                            T metaData)
Description copied from interface: DataType
Set the databinding-specific metadata

Specified by:
setMetaData in interface DataType<L>
Parameters:
type - The java type of the metadata
metaData - the databinding-specific metadata, such as SDO's commonj.sdo.Type or JAXB's javax.xml.bind.JAXBContext