org.pm4j.core.pm.api
Class PmExpressionApi

java.lang.Object
  extended by org.pm4j.core.pm.api.PmExpressionApi

public class PmExpressionApi
extends java.lang.Object


Constructor Summary
PmExpressionApi()
           
 
Method Summary
static java.lang.Object findByExpression(PmObject pm, java.lang.String expression)
          Finds a named property from the following scopes (if available): navigation scope conversation scope @link PmConversation property http-request and session properties application configuration property (e.g.
static
<T> T
findByExpression(PmObject pm, java.lang.String propName, java.lang.Class<T> propType)
          Supports type safe access for PM properties.
static java.lang.Object findNamedObject(PmObject pm, java.lang.String objName)
          Finds an object within the named object scopes of the application.
static java.lang.Object getByExpression(PmObject pm, java.lang.String name)
          Imperative version of #findPmProperty(String).
static
<T> T
getByExpression(PmObject pm, java.lang.String propName, java.lang.Class<T> propType)
          Imperative version of findByExpression(PmObject, String, Class).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PmExpressionApi

public PmExpressionApi()
Method Detail

findByExpression

public static java.lang.Object findByExpression(PmObject pm,
                                                java.lang.String expression)
Finds a named property from the following scopes (if available):
  1. navigation scope
  2. conversation scope
  3. @link PmConversation property
  4. http-request and session properties
  5. application configuration property (e.g. Spring)

Parameters:
expression - Name of the property to find.
Returns:
The found property value or null when not found.

getByExpression

public static java.lang.Object getByExpression(PmObject pm,
                                               java.lang.String name)
                                        throws org.pm4j.core.exception.PmRuntimeException
Imperative version of #findPmProperty(String). Throws an exception if there is no value for the given property.

Parameters:
name - Name of the property to find.
Returns:
The found property value.
Throws:
org.pm4j.core.exception.PmRuntimeException - if there is no value for the given property name.

findByExpression

public static <T> T findByExpression(PmObject pm,
                                     java.lang.String propName,
                                     java.lang.Class<T> propType)
Supports type safe access for PM properties.

Generates a clear PmRuntimeException message with debug hints in case of a property type mismatch.

Type Parameters:
T - The expected property type.
Parameters:
pm - The method calls PmObject#findPmProperty(String) on this object.
propName - Path of the property to find.
propType - The found property will be checked to be an instance of this class.
Returns:
The found property or null.
Throws:
org.pm4j.core.exception.PmRuntimeException - if the found property value is not compatible to the given propType parameter.

getByExpression

public static <T> T getByExpression(PmObject pm,
                                    java.lang.String propName,
                                    java.lang.Class<T> propType)
Imperative version of findByExpression(PmObject, String, Class).

Throws:
org.pm4j.core.exception.PmRuntimeException - if no property value was found.

findNamedObject

public static java.lang.Object findNamedObject(PmObject pm,
                                               java.lang.String objName)
Finds an object within the named object scopes of the application.

In difference to #findPmProperty(String) this method does not support object navigation expressions.

Parameters:
objName - Name of the object to find.
Returns:
The found instance of null.