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.api.MuleEvent; 10 import org.mule.api.processor.MessageProcessor; 11 12 /** 13 * A transformer intended to transform Mule messages rather than arbitrary objects 14 */ 15 public interface MessageTransformer extends Transformer, MessageProcessor 16 { 17 /** 18 * Thransforms the supplied data and returns the result 19 * 20 * @param src the data to transform 21 * @param event the event currently being processed 22 * @return the transformed data 23 * @throws TransformerMessagingException if a error occurs transforming the data or if the 24 * expected returnClass isn't the same as the transformed data 25 */ 26 Object transform(Object src, MuleEvent event) throws TransformerMessagingException; 27 28 /** 29 * Thransforms the supplied data and returns the result 30 * 31 * @param src the data to transform 32 * @param encoding the encoding to use by this transformer. many transformations will not need encoding unless 33 * dealing with text so you only need to use this method if yo wish to customize the encoding 34 * @param event the event currently being processed 35 * @return the transformed data 36 * @throws TransformerMessagingException if a error occurs transforming the data or if the 37 * expected returnClass isn't the same as the transformed data 38 */ 39 Object transform(Object src, String encoding, MuleEvent event) throws TransformerMessagingException; 40 }