org.mule.transformer.types
Class SimpleDataType<T>

java.lang.Object
  extended by org.mule.transformer.types.SimpleDataType<T>
All Implemented Interfaces:
DataType<T>
Direct Known Subclasses:
CollectionDataType

public class SimpleDataType<T>
extends Object
implements DataType<T>

A data type that simply wraps a Java type. This type also allows a mime type to be associated with the Java type.


Field Summary
protected  String mimeType
           
protected  Class type
           
 
Fields inherited from interface org.mule.api.transformer.DataType
ANY_MIME_TYPE
 
Constructor Summary
SimpleDataType(Class type)
           
SimpleDataType(Class type, String mimeType)
           
 
Method Summary
 boolean equals(Object o)
           
 String getMimeType()
          The mime type of the the source object to transform.
 Class getType()
          The object type of the source object to transform.
 int hashCode()
           
 boolean isCompatibleWith(DataType dataType)
          Used to determine if this data type is compatible with the data type passed in.
 void setMimeType(String mimeType)
          The mime type of the the source object to transform.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

type

protected Class type

mimeType

protected String mimeType
Constructor Detail

SimpleDataType

public SimpleDataType(Class type,
                      String mimeType)

SimpleDataType

public SimpleDataType(Class type)
Method Detail

getType

public Class getType()
Description copied from interface: DataType
The object type of the source object to transform.

Specified by:
getType in interface DataType<T>
Returns:
the class object of the source object. This must not be null

getMimeType

public String getMimeType()
Description copied from interface: DataType
The mime type of the the source object to transform.

Specified by:
getMimeType in interface DataType<T>
Returns:
the mime type of the source object. This may be null if the mime type is not known, or if the mime type is not needed

setMimeType

public void setMimeType(String mimeType)
Description copied from interface: DataType
The mime type of the the source object to transform.

Specified by:
setMimeType in interface DataType<T>
Parameters:
mimeType - the mime type of the source object. This may be null if the mime type is not known, or if the mime type is not needed

isCompatibleWith

public boolean isCompatibleWith(DataType dataType)
Description copied from interface: DataType
Used to determine if this data type is compatible with the data type passed in. This checks to see if the mime types are equal and whether the Java types are assignable

Specified by:
isCompatibleWith in interface DataType<T>
Parameters:
dataType - the dataType object to compare with
Returns:
true if the mime types are the same and this type can be assigned to the dataType.type.

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2003-2009 MuleSource, Inc.. All Rights Reserved.