JFCML - JFC/Swing
XML Markup Language

com.metasolutions.jfcml.script
Class JFCMLScript

java.lang.Object
  extended by com.metasolutions.jfcml.helpers.DocumentHandler
      extended by com.metasolutions.jfcml.script.JFCMLScript
All Implemented Interfaces:
Serializable

public class JFCMLScript
extends DocumentHandler

JFCML's default script evaluation service.

Version:
0.9 Jun 6, 2005
Author:
Shawn Curry
See Also:
Serialized Form

Field Summary
protected  ReflectionHandler handler
          The ReflectionHandler, used for various reflection oriented activities.
protected  StatementHandler statementHandler
          The StatementHandler delegate.
 
Fields inherited from class com.metasolutions.jfcml.helpers.DocumentHandler
windowContext
 
Constructor Summary
JFCMLScript(WindowContext windowContext, ReflectionHandler handler)
          Creates an instance of the JFCMLScript interpreter using the specified WindowContext.
JFCMLScript(WindowContext context, StatementHandler statementHandler, ReflectionHandler reflectionHandler)
          Creates an instance of the JFCMLScript interpreter using the specified WindowContext and StatementHandler.
 
Method Summary
 void addStatementHandler(StatementHandler handler)
          Adds a StatementHandler to the current chain.
 Object eval(String stmt)
          Evaluates a statement using the JFCMLScript interpreter.
 Object get(String name)
          Gets a variable.
 Class getArrayClass(String spec)
           
 Object parseArray(Class cls, String spec)
           
 Object parseCast(String spec)
           
 Object parseConstant(String spec)
           
 Object parseConstructor(String spec)
           
 Object parseConstructor(String clsname, SimpleStack args)
           
 Object parseMethod(String spec)
           
 Object[] parseStatement(String stmt)
           
 Object parseVariable(String s)
          Parse a clear text statement representing some previously named variable, then find and return it.
 void set(String name, Object var)
          Sets a variable.
 void unset(String name)
          Unsets a variable.
 
Methods inherited from class com.metasolutions.jfcml.helpers.DocumentHandler
getWindowContext, setWindowContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

statementHandler

protected StatementHandler statementHandler
The StatementHandler delegate.


handler

protected ReflectionHandler handler
The ReflectionHandler, used for various reflection oriented activities.

Constructor Detail

JFCMLScript

public JFCMLScript(WindowContext windowContext,
                   ReflectionHandler handler)
Creates an instance of the JFCMLScript interpreter using the specified WindowContext.

Parameters:
windowContext - the WindowContext to use.

JFCMLScript

public JFCMLScript(WindowContext context,
                   StatementHandler statementHandler,
                   ReflectionHandler reflectionHandler)
Creates an instance of the JFCMLScript interpreter using the specified WindowContext and StatementHandler.

Parameters:
context - the WindowContext to use.
handler - the StatementHandler to use.
Method Detail

eval

public Object eval(String stmt)
Evaluates a statement using the JFCMLScript interpreter.

Parameters:
stmt - the statement to evaluate.
Returns:
the result of the statement, or null if it could not be evaluated.

get

public Object get(String name)
Gets a variable.

Parameters:
name - the variable name.
Returns:
the variable, if it exists, or null if it does not.

set

public void set(String name,
                Object var)
Sets a variable.

Parameters:
name - the variable name.
var - the variable.

unset

public void unset(String name)
Unsets a variable.

Parameters:
name - the variable name.

addStatementHandler

public void addStatementHandler(StatementHandler handler)
Adds a StatementHandler to the current chain.

Parameters:
statementHandler - The statementHandler to add.

parseStatement

public Object[] parseStatement(String stmt)

parseCast

public Object parseCast(String spec)
Parameters:
spec -
Returns:

parseVariable

public Object parseVariable(String s)
Parse a clear text statement representing some previously named variable, then find and return it. This statement fragment is expected to appear as follows:

variable('name') where name is the symbolic name previously given to the desired variable.

Parameters:
s - Statement fragment to parse.
Returns:
The requested Object, or null if it could not be located.
Throws:
RuntimeException - If the statment fragment was incorrectly formatted
NullPointerException - If the statement fragment was absent.

parseConstant

public Object parseConstant(String spec)

parseConstructor

public Object parseConstructor(String spec)

parseConstructor

public Object parseConstructor(String clsname,
                               SimpleStack args)

getArrayClass

public Class getArrayClass(String spec)

parseArray

public Object parseArray(Class cls,
                         String spec)

parseMethod

public Object parseMethod(String spec)

SourceForge.net
java.net

Copyright 2004-2005 Shawn Curry, http://jfcml.sourceforge.net
Licensed under the Academic Free License version 2.1