Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
Transformer |
|
| 1.0;1 |
1 | /* | |
2 | * $Id: Transformer.java 12269 2008-07-10 04:19:03Z dfeist $ | |
3 | * -------------------------------------------------------------------------------------- | |
4 | * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.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 java.util.List; | |
14 | ||
15 | /** | |
16 | * <code>Transformer</code> can be chained together to covert message payloads | |
17 | * from one object type to another. | |
18 | */ | |
19 | public interface Transformer extends BaseTransformer | |
20 | { | |
21 | ||
22 | /** | |
23 | * Determines if a particular source class can be handled by this transformer | |
24 | * | |
25 | * @param aClass The class to check for compatability | |
26 | * @return true if the transformer supports this type of class or false | |
27 | * otherwise | |
28 | */ | |
29 | boolean isSourceTypeSupported(Class aClass); | |
30 | ||
31 | ||
32 | /** | |
33 | * Returns an unmodifiable list of Source types registered on this transformer | |
34 | * | |
35 | * @return an unmodifiable list of Source types registered on this transformer | |
36 | */ | |
37 | List getSourceTypes(); | |
38 | ||
39 | /** | |
40 | * Does this transformer allow null input? | |
41 | * | |
42 | * @return true if this transformer can accept null input | |
43 | */ | |
44 | boolean isAcceptNull(); | |
45 | ||
46 | boolean isIgnoreBadInput(); | |
47 | ||
48 | /** | |
49 | * Thransforms the supplied data and returns the result | |
50 | * | |
51 | * @param src the data to transform | |
52 | * @return the transformed data | |
53 | * @throws TransformerException if a error occurs transforming the data or if the | |
54 | * expected returnClass isn't the same as the transformed data | |
55 | */ | |
56 | Object transform(Object src) throws TransformerException; | |
57 | ||
58 | /** | |
59 | * Sets the expected return type for the transformed data. If the transformed | |
60 | * data is not of this class type a <code>TransformerException</code> will be | |
61 | * thrown. | |
62 | * | |
63 | * @param theClass the expected return type class | |
64 | */ | |
65 | void setReturnClass(Class theClass); | |
66 | ||
67 | /** @return the exceptedreturn type */ | |
68 | Class getReturnClass(); | |
69 | ||
70 | } |