01: /*
02: * $Id: AbstractEventTransformer.java 10789 2008-02-12 20:04:43Z dfeist $
03: * --------------------------------------------------------------------------------------
04: * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com
05: *
06: * The software in this package is published under the terms of the CPAL v1.0
07: * license, a copy of which has been included with this distribution in the
08: * LICENSE.txt file.
09: */
10:
11: package org.mule.module.client;
12:
13: import org.mule.api.MuleMessage;
14: import org.mule.api.config.MuleProperties;
15: import org.mule.api.transformer.TransformerException;
16: import org.mule.transformer.AbstractTransformer;
17:
18: import java.lang.reflect.Method;
19:
20: /**
21: * <code>AbstractEventTransformer</code> adds support for adding method details to
22: * the result message.
23: */
24:
25: public abstract class AbstractEventTransformer extends
26: AbstractTransformer {
27: protected AbstractEventTransformer() {
28: setReturnClass(MuleMessage.class);
29: }
30:
31: public MuleMessage transform(Object src, Method method)
32: throws TransformerException {
33: MuleMessage message = (MuleMessage) transform(src);
34: message.setProperty(MuleProperties.MULE_METHOD_PROPERTY, method
35: .getName());
36: return message;
37: }
38: }
|