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

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

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

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

Since:
3.0
See Also:
Serialized Form

Field Summary
protected  String encoding
           
protected  String mimeType
           
protected  Class<?> type
           
 
Fields inherited from interface org.mule.api.transformer.DataType
ANY_MIME_TYPE, BYTE_ARRAY_DATA_TYPE, STRING_DATA_TYPE
 
Constructor Summary
SimpleDataType(Class type)
           
SimpleDataType(Class<?> type, String mimeType)
           
 
Method Summary
 DataType cloneDataType()
          Create an exact copy of this datatype
 boolean equals(Object o)
           
 String getEncoding()
          The encoding for the object to transform
 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 setEncoding(String encoding)
          The encoding for the object to transform
 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

encoding

protected String encoding
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

getEncoding

public String getEncoding()
Description copied from interface: DataType
The encoding for the object to transform

Specified by:
getEncoding in interface DataType<T>

setEncoding

public void setEncoding(String encoding)
Description copied from interface: DataType
The encoding for the object to transform

Specified by:
setEncoding in interface DataType<T>

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

cloneDataType

public DataType cloneDataType()
Description copied from interface: DataType
Create an exact copy of this datatype

Specified by:
cloneDataType in interface DataType<T>


Copyright © 2003-2012 MuleSoft, Inc.. All Rights Reserved.