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