|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.formaria.aria.evaluator.DefaultAttributeEvaluator
public class DefaultAttributeEvaluator
An attribute evaluator
An evaluated attribute's implementing method is by default in the owner page such that a reference like
${myMethod()}
would evaluate to a method in the current page with a signature like:
public void myMethod();
The attributes can also be defined in classes other than the current page or classes derived from Page. The syntax for such expressions is as follows:
${mypackage.MyClass[referenceName].myMethod(args...)} for a named object instance${mypackage.MyClass[].myMethod(args...)} to create a new instance of the class on each evaluation${mypackage.MyClass.myMethod(args...)} to invoke a static method${myMethod[referenceName](args...)} for a method contained with the invoking page${this[componentName].componentMethod(args...)} for a method contained within named component${this.method(args...)} for a method contained within the enclosing page, identical to 4 above${project.method(args...)} for a method contained within the project${this} for a reference to the pagewhere mypackage is the name of the Java package containing the class MyClass. The value of referenceName is a user defined value that identifies the instance of the class. The application instantiates an instance of the class when the expression is first encountered and thereafter maintains the instance with each subsequent call retrieving the same instance of the class.
The method call can contain zero or more arguments
Copyright (c) Formaria Ltd., 2008
$Revision: 2.8 $
License: see License.txt
| Field Summary | |
|---|---|
protected java.util.Hashtable |
classInstances
The collection of class instances that are known to implement the methods of evaluated attributes |
protected Project |
currentProject
|
protected ExceptionHandler |
exceptionHandler
|
protected java.lang.Object |
provider
|
protected java.lang.Object |
result
|
| Constructor Summary | |
|---|---|
DefaultAttributeEvaluator(Project project)
Create a new evaluator |
|
| Method Summary | |
|---|---|
java.lang.Object |
evaluateAttribute(java.lang.Object instance,
java.lang.String attributeValue)
Get the value of an attribute. |
MethodReference |
getMethodReference(java.lang.Object instance,
java.lang.String attributeValue)
Get the value of an attribute by evaluating a method reference |
MethodReference |
getMethodReference(java.lang.String attributeValue)
Get the method reference for the methods named in the attribute |
java.lang.Object |
getObject()
Get the current provider object. |
java.lang.Object |
getResult()
Explicitly get the result of an evaluation. |
protected java.lang.Object |
lookupReference(java.lang.String reference)
Lookup a reference |
void |
setCurrentProject(Project project)
Set the current project and complete any initialization that depends on the project reference/instance. |
void |
setExceptionHandler(ExceptionHandler eh)
Set an exception handler for processing exceptions |
void |
setResult(java.lang.Object value)
Explicitly set the result of an evaluation. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.util.Hashtable classInstances
protected java.lang.Object provider
protected Project currentProject
protected ExceptionHandler exceptionHandler
protected java.lang.Object result
| Constructor Detail |
|---|
public DefaultAttributeEvaluator(Project project)
currentProject - the current projectproject - the current or owning project| Method Detail |
|---|
public void setCurrentProject(Project project)
setCurrentProject in interface AttributeEvaluatorproject - the current or owning projectpublic void setExceptionHandler(ExceptionHandler eh)
setExceptionHandler in interface AttributeEvaluatoreh - the exception handlerpublic void setResult(java.lang.Object value)
setResult in interface AttributeEvaluatorthe - new result valuepublic java.lang.Object getResult()
getResult in interface AttributeEvaluator
public java.lang.Object evaluateAttribute(java.lang.Object instance,
java.lang.String attributeValue)
evaluateAttribute in interface AttributeEvaluatorinstance - the page or instance that provides the methods/field for the evaluatorattributeValue - the raw value of the attribute
public MethodReference getMethodReference(java.lang.String attributeValue)
getMethodReference in interface AttributeEvaluatorattributeValue - the method name
public MethodReference getMethodReference(java.lang.Object instance,
java.lang.String attributeValue)
getMethodReference in interface AttributeEvaluatorinstnace - the page or object from that provides the methods or fields referenced in the evaluationattributeValue - the attribute to be evaluated
protected java.lang.Object lookupReference(java.lang.String reference)
reference - a stripped reference e.g. values - which would have been
specified as ${values}
public java.lang.Object getObject()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||