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

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

public class CollectionDataType<T>
extends SimpleDataType<T>

A data type that represents a generified collection. When checked for compatability both the colection type and the generic item type will be compared.

Since:
3.0
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.mule.transformer.types.SimpleDataType
encoding, mimeType, type
 
Fields inherited from interface org.mule.api.transformer.DataType
ANY_MIME_TYPE, BYTE_ARRAY_DATA_TYPE, STRING_DATA_TYPE
 
Constructor Summary
CollectionDataType(Class<? extends Collection> collectionType)
          Creates an untyped collection data type
CollectionDataType(Class<? extends Collection> collectionType, Class type)
           
CollectionDataType(Class<? extends Collection> collectionType, Class type, String mimeType)
           
CollectionDataType(Class<? extends Collection> collectionType, String mimeType)
           
 
Method Summary
static CollectionDataType createFromMethodParam(Method m, int paramIndex)
           
static CollectionDataType createFromMethodParam(Method m, int paramIndex, String mimeType)
           
static CollectionDataType createFromMethodReturn(Method m)
           
static CollectionDataType createFromMethodReturn(Method m, String mimeType)
           
 boolean equals(Object o)
           
 Class<?> getItemType()
           
 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.
static boolean isParamTypeACollection(Method m, int paramIndex)
           
static boolean isReturnTypeACollection(Method m)
           
 String toString()
           
 
Methods inherited from class org.mule.transformer.types.SimpleDataType
cloneDataType, getEncoding, getMimeType, setEncoding, setMimeType
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CollectionDataType

public CollectionDataType(Class<? extends Collection> collectionType)
Creates an untyped collection data type

Parameters:
collectionType - the collection class type

CollectionDataType

public CollectionDataType(Class<? extends Collection> collectionType,
                          String mimeType)

CollectionDataType

public CollectionDataType(Class<? extends Collection> collectionType,
                          Class type,
                          String mimeType)

CollectionDataType

public CollectionDataType(Class<? extends Collection> collectionType,
                          Class type)
Method Detail

getItemType

public Class<?> getItemType()

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>
Overrides:
getType in class SimpleDataType<T>
Returns:
the class object of the source object. This must not be null

createFromMethodReturn

public static CollectionDataType createFromMethodReturn(Method m)

createFromMethodReturn

public static CollectionDataType createFromMethodReturn(Method m,
                                                        String mimeType)

createFromMethodParam

public static CollectionDataType createFromMethodParam(Method m,
                                                       int paramIndex)

createFromMethodParam

public static CollectionDataType createFromMethodParam(Method m,
                                                       int paramIndex,
                                                       String mimeType)

isReturnTypeACollection

public static boolean isReturnTypeACollection(Method m)

isParamTypeACollection

public static boolean isParamTypeACollection(Method m,
                                             int paramIndex)

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>
Overrides:
isCompatibleWith in class SimpleDataType<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 SimpleDataType<T>

hashCode

public int hashCode()
Overrides:
hashCode in class SimpleDataType<T>

toString

public String toString()
Overrides:
toString in class SimpleDataType<T>


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