org.pm4j.core.pm.impl.pathresolver
Class PmExpressionPathResolver

java.lang.Object
  extended by org.pm4j.core.pm.impl.pathresolver.PathResolverBase
      extended by org.pm4j.core.pm.impl.pathresolver.PmExpressionPathResolver
All Implemented Interfaces:
PathResolver

public class PmExpressionPathResolver
extends PathResolverBase

A path resolver that uses an Expression.

Provides a simplified interface for getting an setting values by using expressions.

Author:
olaf boede

Constructor Summary
protected PmExpressionPathResolver(Expression expression)
           
protected PmExpressionPathResolver(ParseCtxt parseCtxt, boolean isStartAttrAllowed)
           
protected PmExpressionPathResolver(java.lang.String exprString, boolean isStartAttrAllowed)
           
 
Method Summary
 java.lang.Object getValue(java.lang.Object startObj)
           
 java.lang.Object getValue(java.lang.Object pmCtxt, java.lang.Object startObj)
           
static PathResolver parse(ParseCtxt parseCtxt, boolean isStartAttrAllowed)
           
static PathResolver parse(java.lang.String exprString, boolean isStartAttrAllowed)
           
 void setValue(java.lang.Object startObj, java.lang.Object value)
           
 
Methods inherited from class org.pm4j.core.pm.impl.pathresolver.PathResolverBase
isNullAllowed, setNullAllowed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PmExpressionPathResolver

protected PmExpressionPathResolver(java.lang.String exprString,
                                   boolean isStartAttrAllowed)
Parameters:
exprString - The string to parse.
isStartAttrAllowed - Defines if the first expression part may address a field.

Is used to prevent initializaion loops for injected fields that use the name of a referenced variable.


PmExpressionPathResolver

protected PmExpressionPathResolver(ParseCtxt parseCtxt,
                                   boolean isStartAttrAllowed)

PmExpressionPathResolver

protected PmExpressionPathResolver(Expression expression)
Method Detail

parse

public static PathResolver parse(java.lang.String exprString,
                                 boolean isStartAttrAllowed)
Parameters:
exprString - The string to parse.
isStartAttrAllowed - Defines if the first expression part may address a field.

Is used to prevent initializaion loops for injected fields that use the name of a referenced variable.


parse

public static PathResolver parse(ParseCtxt parseCtxt,
                                 boolean isStartAttrAllowed)

getValue

public java.lang.Object getValue(java.lang.Object startObj)
Parameters:
startObj - The object to start the navigation from.
Returns:
The found value according to the path specification.

getValue

public java.lang.Object getValue(java.lang.Object pmCtxt,
                                 java.lang.Object startObj)
Parameters:
pmCtxt - The instance, used to create the execution context from.
Usually used to provide access to variables.
startObj - The instance to start the evaluation from.
Returns:
The evaluation result.

setValue

public void setValue(java.lang.Object startObj,
                     java.lang.Object value)
Parameters:
startObj - The object to start the navigation from.
value - The value to set to the field, addressed by the path.