View Javadoc
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.tck.transformer;
8   
9   import org.mule.api.transformer.TransformerException;
10  import org.mule.transformer.AbstractTransformer;
11  import org.mule.transformer.types.DataTypeFactory;
12  
13  /**
14   * <code>NoActionTransformer</code> doesn't do any transformation on the source
15   * object and returns the source as the result. This can be used to overload the
16   * default transform for an endpoint.
17   */
18  public final class NoActionTransformer extends AbstractTransformer
19  {
20  
21      public NoActionTransformer()
22      {
23          registerSourceType(DataTypeFactory.OBJECT);
24          setReturnDataType(DataTypeFactory.OBJECT);
25      }
26  
27      @Override
28      public Object doTransform(Object src, String encoding) throws TransformerException
29      {
30          return src;
31      }
32  
33      @Override
34      public boolean isAcceptNull()
35      {
36          return true;
37      }
38  
39  }