net.xoetrope.optional.evaluator
Class XGroovyEvaluator

java.lang.Object
  extended by net.xoetrope.optional.evaluator.XGroovyEvaluator
All Implemented Interfaces:
XAttributeEvaluator

public class XGroovyEvaluator
extends java.lang.Object

    
implements XAttributeEvaluator

    

An attribute evaluator

Copyright (c) Xoetrope Ltd., 2002-2004

$Revision: 2.3 $

License: see License.txt


Field Summary
protected  groovy.lang.GroovyShell groovyShell
           
protected  java.util.Hashtable referenceObjects
           
 
Constructor Summary
XGroovyEvaluator()
           
 
Method Summary
 java.lang.Object evaluateAttribute(PageSupport page, java.lang.String attributeValue)
          Get the value of an attribute.
 XMethodReference getMethodReference(PageSupport page, java.lang.String attributeValue)
          Get the value of an attribute by evaluating a method reference
 XMethodReference getMethodReference(java.lang.String attributeValue)
          Get the value of an attribute by evaluating a method reference
 void setCurrentProject(XProject currentProject)
          Set the current project and complete any initialization that depends on the project reference/instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

referenceObjects

protected java.util.Hashtable referenceObjects

groovyShell

protected groovy.lang.GroovyShell groovyShell
Constructor Detail

XGroovyEvaluator

public XGroovyEvaluator()
Method Detail

setCurrentProject

public void setCurrentProject(XProject currentProject)
Set the current project and complete any initialization that depends on the project reference/instance.

Specified by:
setCurrentProject in interface XAttributeEvaluator
Parameters:
project - the current or owning project

evaluateAttribute

public java.lang.Object evaluateAttribute(PageSupport page,
                                          java.lang.String attributeValue)
Get the value of an attribute.

Specified by:
evaluateAttribute in interface XAttributeEvaluator
Parameters:
page - the page being loaded
attributeValue - the raw value of the attribute
Returns:
the evaluated value of the attribute

getMethodReference

public XMethodReference getMethodReference(java.lang.String attributeValue)
Get the value of an attribute by evaluating a method reference

Specified by:
getMethodReference in interface XAttributeEvaluator
Parameters:
attributeValue - the method name
Returns:
the method reference or null if the referenced/named method cannot be found

getMethodReference

public XMethodReference getMethodReference(PageSupport page,
                                           java.lang.String attributeValue)
Get the value of an attribute by evaluating a method reference

Specified by:
getMethodReference in interface XAttributeEvaluator
Parameters:
page - the current page
attributeValue - the method name
Returns:
the method reference or null if the referenced/named method cannot be found