Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
MessageTransformer |
|
| 1.0;1 |
1 | /* | |
2 | * $Id: MessageTransformer.java 19191 2010-08-25 21:05:23Z tcarlson $ | |
3 | * -------------------------------------------------------------------------------------- | |
4 | * Copyright (c) MuleSoft, Inc. All rights reserved. http://www.mulesoft.com | |
5 | * | |
6 | * The software in this package is published under the terms of the CPAL v1.0 | |
7 | * license, a copy of which has been included with this distribution in the | |
8 | * LICENSE.txt file. | |
9 | */ | |
10 | ||
11 | package org.mule.api.transformer; | |
12 | ||
13 | import org.mule.api.MuleEvent; | |
14 | import org.mule.api.processor.MessageProcessor; | |
15 | ||
16 | /** | |
17 | * A transformer intended to transform Mule messages rather than arbitrary objects | |
18 | */ | |
19 | public interface MessageTransformer extends Transformer, MessageProcessor | |
20 | { | |
21 | /** | |
22 | * Thransforms the supplied data and returns the result | |
23 | * | |
24 | * @param src the data to transform | |
25 | * @param event the event currently being processed | |
26 | * @return the transformed data | |
27 | * @throws TransformerMessagingException if a error occurs transforming the data or if the | |
28 | * expected returnClass isn't the same as the transformed data | |
29 | */ | |
30 | Object transform(Object src, MuleEvent event) throws TransformerMessagingException; | |
31 | ||
32 | /** | |
33 | * Thransforms the supplied data and returns the result | |
34 | * | |
35 | * @param src the data to transform | |
36 | * @param encoding the encoding to use by this transformer. many transformations will not need encoding unless | |
37 | * dealing with text so you only need to use this method if yo wish to customize the encoding | |
38 | * @param event the event currently being processed | |
39 | * @return the transformed data | |
40 | * @throws TransformerMessagingException if a error occurs transforming the data or if the | |
41 | * expected returnClass isn't the same as the transformed data | |
42 | */ | |
43 | Object transform(Object src, String encoding, MuleEvent event) throws TransformerMessagingException; | |
44 | } |