Coverage Report - org.mule.api.transformer.DataType
 
Classes in this File Line Coverage Branch Coverage Complexity
DataType
N/A
N/A
0
 
 1  
 /*
 2  
  * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
 3  
  * The software in this package is published under the terms of the CPAL v1.0
 4  
  * license, a copy of which has been included with this distribution in the
 5  
  * LICENSE.txt file.
 6  
  */
 7  
 package org.mule.api.transformer;
 8  
 
 9  
 import org.mule.transformer.types.DataTypeFactory;
 10  
 
 11  
 import java.io.Serializable;
 12  
 
 13  
 /**
 14  
  * Defines a Java type associated with additional information about the data.  This may be a mime 
 15  
  * type for the type or for collections, the collection item type can be stored with the collection 
 16  
  * type.
 17  
  *
 18  
  * @since 3.0.0
 19  
  */
 20  
 public interface DataType<T> extends Serializable, Cloneable
 21  
 {
 22  
     public static final String ANY_MIME_TYPE = "*/*";
 23  
 
 24  
     /**
 25  
      * The object type of the source object to transform.
 26  
      *
 27  
      * @return the class object of the source object. This must not be null
 28  
      */
 29  
     Class<?> getType();
 30  
 
 31  
     /**
 32  
      * The mime type of the the source object to transform.
 33  
      *
 34  
      * @return the mime type of the source object. This may be null if the mime type is not known, or if the mime type is
 35  
      *         not needed
 36  
      */
 37  
     String getMimeType();
 38  
 
 39  
     /**
 40  
      * The encoding for the object to transform
 41  
      */
 42  
     String getEncoding();
 43  
 
 44  
     /**
 45  
      * The encoding for the object to transform
 46  
      */
 47  
     void setEncoding(String encoding);
 48  
 
 49  
     /**
 50  
      * The mime type of the the source object to transform.
 51  
      *
 52  
      * @param 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
 53  
      *                 not needed
 54  
      */
 55  
     void setMimeType(String mimeType);
 56  
 
 57  
     /**
 58  
      * Used to determine if this data type is compatible with the data type passed in.  This checks to see if the mime types are
 59  
      * equal and whether the Java types are assignable
 60  
      *
 61  
      * @param dataType the dataType object to compare with
 62  
      * @return true if the mime types are the same and this type can be assigned to the dataType.type.
 63  
      */
 64  
     boolean isCompatibleWith(DataType dataType);
 65  
 
 66  
     /**
 67  
      * Create an exact copy of this datatype
 68  
      */
 69  
     DataType cloneDataType();
 70  
 
 71  
     DataType<byte[]> BYTE_ARRAY_DATA_TYPE = (DataType<byte[]>) DataTypeFactory.createImmutable(byte[].class);
 72  
 
 73  
     DataType<String> STRING_DATA_TYPE = (DataType<String>) DataTypeFactory.createImmutable(String.class);
 74  
 }