org.apache.commons.scxml
Class Builtin

java.lang.Object
  extended byorg.apache.commons.scxml.Builtin

public class Builtin
extends Object

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


Constructor Summary
Builtin()
           
 
Method Summary
static Object data(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 Node dataNode(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 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(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:
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)
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-2006 The Apache Software Foundation. All Rights Reserved.