org.apache.commons.scxml
Class Builtin

java.lang.Object
  extended by org.apache.commons.scxml.Builtin
All Implemented Interfaces:
Serializable

public class Builtin
extends Object
implements Serializable

Implementations of builtin functions defined by the SCXML specification. The current version of the specification defines one builtin predicate In()

See Also:
Serialized Form

Constructor Summary
Builtin()
           
 
Method Summary
static Object data(Map namespaces, Object data, String path)
          A variant of the Data() function for Commons SCXML documents, coerced to a Double, a Long or a String, whichever succeeds, in that order.
static Object data(Object data, String path)
          Deprecated. Use data(Map,Object,String) instead
static Node dataNode(Map namespaces, Object data, String path)
          Implements the Data() function for Commons SCXML documents, that can be used to obtain a node from one of the XML data trees.
static Node dataNode(Object data, String path)
          Deprecated. Use dataNode(Map,Object,String) instead
static boolean isMember(Set allStates, String state)
          Implements the In() predicate for SCXML documents.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Builtin

public Builtin()
Method Detail

isMember

public static boolean isMember(Set allStates,
                               String state)
Implements the In() predicate for SCXML documents. The method name chosen is different since "in" is a reserved token in some expression languages. Does this state belong to the given Set of States. Simple ID based comparator, assumes IDs are unique.

Parameters:
allStates - The Set of State objects to look in
state - The State ID to compare with
Returns:
Whether this State belongs to this Set

dataNode

public static Node dataNode(Map namespaces,
                            Object data,
                            String path)
Implements the Data() function for Commons SCXML documents, that can be used to obtain a node from one of the XML data trees. Manifests within "location" attribute of <assign> element, for Commons JEXL and Commons EL based documents.

Parameters:
namespaces - The current document namespaces map at XPath location
data - The context Node, though the method accepts an Object so error is reported by Commons SCXML, rather than the underlying expression language.
path - The XPath expression.
Returns:
The first node matching the path, or null if no nodes match.

data

public static Object data(Map namespaces,
                          Object data,
                          String path)
A variant of the Data() function for Commons SCXML documents, coerced to a Double, a Long or a String, whichever succeeds, in that order. Manifests within rvalue expressions in the document, for Commons JEXL and Commons EL based documents..

Parameters:
namespaces - The current document namespaces map at XPath location
data - The context Node, though the method accepts an Object so error is reported by Commons SCXML, rather than the underlying expression language.
path - The XPath expression.
Returns:
The first node matching the path, coerced to a String, or null if no nodes match.

dataNode

public static Node dataNode(Object data,
                            String path)
Deprecated. Use dataNode(Map,Object,String) instead

Implements the Data() function for Commons SCXML documents, that can be used to obtain a node from one of the XML data trees. Manifests within "location" attribute of <assign> element, for Commons JEXL and Commons EL based documents.

Parameters:
data - The context Node, though the method accepts an Object so error is reported by Commons SCXML, rather than the underlying expression language.
path - The XPath expression.
Returns:
The first node matching the path, or null if no nodes match.

data

public static Object data(Object data,
                          String path)
Deprecated. Use data(Map,Object,String) instead

A variant of the Data() function for Commons SCXML documents, coerced to a Double, a Long or a String, whichever succeeds, in that order. Manifests within rvalue expressions in the document, for Commons JEXL and Commons EL based documents..

Parameters:
data - The context Node, though the method accepts an Object so error is reported by Commons SCXML, rather than the underlying expression language.
path - The XPath expression.
Returns:
The first node matching the path, coerced to a String, or null if no nodes match.


Copyright © 2005-2008 The Apache Software Foundation. All Rights Reserved.