View Javadoc

1   /*
2    * $Id: BeanPayloadExpressionEvaluator.java 11231 2008-03-06 21:17:37Z rossmason $
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  package org.mule.module.xml.expression;
11  
12  import org.jaxen.JaxenException;
13  import org.jaxen.XPath;
14  import org.jaxen.javabean.JavaBeanXPath;
15  
16  /** TODO */
17  public class BeanPayloadExpressionEvaluator extends AbstractXPathExpressionEvaluator
18  {
19      public static final String NAME = "bean";
20  
21      protected XPath createXPath(String expression, Object object) throws JaxenException
22      {
23          expression = expression.replaceAll("[.]", "/");
24          return new JavaBeanXPath(expression);
25      }
26  
27      protected Object extractResultFromNode(Object result)
28      {
29          return ((org.jaxen.javabean.Element)result).getObject();
30      }
31  
32      /** {@inheritDoc} */
33      public String getName()
34      {
35          return NAME;
36      }
37  }