com.wewebu.expression.language
Class OwExprExternalScope

java.lang.Object
  extended by com.wewebu.expression.language.OwExprExternalScope
All Implemented Interfaces:
OwExprScope
Direct Known Subclasses:
OwExprReflectiveScope

public class OwExprExternalScope
extends Object
implements OwExprScope

External scopes are property and function domains Java API interfaces.
External scopes can be used on their own as collections of properties and functions. This version only supports adding properties!
By extending this class custom scopes can be made available during expressions evaluation.

Alfresco Workdesk
Copyright (c) Alfresco Software, Inc.
All rights reserved.

For licensing information read the license.txt file or
go to: http://wiki.alfresco.com


Constructor Summary
OwExprExternalScope(String name_p)
          Constructor
 
Method Summary
 void addScope(OwExprExternalScope externalScope_p)
          Adds a sub scope to this scope.
Scopes are stored as properties of this scope.
 OwExprProperty at(int index_p)
          Indexed scope access method
 OwExprFunction function(String functionName_p, OwExprExpressionType[] argunmentTypes_p)
          Function access method.
 String getName()
           
 boolean hasProperty(String propertyName_p)
          Property access helper method.
 int length()
          Indexed scope access helper method
protected  OwExprFunction prelevateFunction(String functionName_p, OwExprExpressionType[] argumentTypes_p)
          Function search hook for function(String, OwExprExpressionType[]).
Children of this class should override this method to perform custom
protected  OwExprProperty prelevateProperty(String propertyName_p)
          Property search hook for property(String).
 OwExprProperty property(String propertyName_p)
          Property access method.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OwExprExternalScope

public OwExprExternalScope(String name_p)
Constructor

Parameters:
name_p - the name of this scope. The scope will be referenced by this name in the evaluated expressions.
Method Detail

addScope

public final void addScope(OwExprExternalScope externalScope_p)
Adds a sub scope to this scope.
Scopes are stored as properties of this scope.

Parameters:
externalScope_p - the sub scope to add

function

public final OwExprFunction function(String functionName_p,
                                     OwExprExpressionType[] argunmentTypes_p)
                              throws OwExprEvaluationException
Description copied from interface: OwExprScope
Function access method.

Specified by:
function in interface OwExprScope
Parameters:
functionName_p - the name of the requested function
argunmentTypes_p - the argument types of the requested function
Returns:
the function defined by this scope that matches the requested name and argument types
Throws:
OwExprEvaluationException

property

public final OwExprProperty property(String propertyName_p)
                              throws OwExprEvaluationException
Description copied from interface: OwExprScope
Property access method.

Specified by:
property in interface OwExprScope
Parameters:
propertyName_p -
Returns:
the function defined by this scope that matches the requested name
Throws:
OwExprEvaluationException

prelevateFunction

protected OwExprFunction prelevateFunction(String functionName_p,
                                           OwExprExpressionType[] argumentTypes_p)
                                    throws OwExprEvaluationException
Function search hook for function(String, OwExprExpressionType[]).
Children of this class should override this method to perform custom

Parameters:
functionName_p -
argumentTypes_p -
Returns:
always null
Throws:
OwExprEvaluationException

prelevateProperty

protected OwExprProperty prelevateProperty(String propertyName_p)
                                    throws OwExprEvaluationException
Property search hook for property(String).

Parameters:
propertyName_p -
Returns:
a property that was previously added using addScope(OwExprExternalScope) or null if no such property was added
Throws:
OwExprEvaluationException

getName

public final String getName()

toString

public String toString()
Overrides:
toString in class Object

at

public OwExprProperty at(int index_p)
                  throws OwExprEvaluationException
Description copied from interface: OwExprScope
Indexed scope access method

Specified by:
at in interface OwExprScope
Parameters:
index_p - int index of the requested property
Returns:
the OwExprProperty property found at the requested index
Throws:
OwExprEvaluationException - if the requested indexed access has failed (index out of bounds, the creation of OwExprProperty has failed)

length

public int length()
           throws OwExprEvaluationException
Description copied from interface: OwExprScope
Indexed scope access helper method

Specified by:
length in interface OwExprScope
Returns:
the maximum index range for which indexed access is possible in this scope
Throws:
OwExprEvaluationException

hasProperty

public boolean hasProperty(String propertyName_p)
                    throws OwExprEvaluationException
Description copied from interface: OwExprScope
Property access helper method. Checks if a property is valid in this scope.

Specified by:
hasProperty in interface OwExprScope
Parameters:
propertyName_p - the name of the requested property
Returns:
true if this scope can perform property access for the requested property - an access via OwExprScope.property(String) will NOT fail on missing property grounds, false otherwise
Throws:
OwExprEvaluationException - if the property validity check has failed


Copyright © 2013 Alfresco Business Solutions. All Rights Reserved.