com.codestreet.selector
Class Selector

java.lang.Object
  extended bycom.codestreet.selector.Selector
All Implemented Interfaces:
ISelector

public class Selector
extends java.lang.Object
implements ISelector

Thread safe Selector implementation.

Author:
Jawaid Hakim.

Method Summary
 Result eval(IValueProvider provider, java.lang.Object corr)
          Evaluate the selector.
 Result eval(java.util.Map identifiers)
          Evaluate the selector.
 java.util.Map getIdentifiers()
          Get identifiers used by the selector.
static Selector getInstance(java.lang.String selector)
          Factory.
static Selector getInstance(java.lang.String selector, boolean trace)
          Factory.
 java.lang.String getSelector()
          Get the selector.
 java.lang.String toString()
          Get selector parse tree.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getInstance

public static Selector getInstance(java.lang.String selector)
                            throws InvalidSelectorException
Factory.

Parameters:
selector - Selector.
Returns:
Selector instance.
Throws:
java.lang.NullPointerException
InvalidSelectorException
See Also:
getInstance(String, boolean)

getInstance

public static Selector getInstance(java.lang.String selector,
                                   boolean trace)
                            throws InvalidSelectorException
Factory.

Parameters:
selector - Selector.
trace - Parser outputs trace if true .
Returns:
Selector instance.
Throws:
java.lang.NullPointerException
InvalidSelectorException
See Also:
getInstance(String)

eval

public Result eval(java.util.Map identifiers)
Evaluate the selector.

Specified by:
eval in interface ISelector
Parameters:
identifiers - Value for each non-null identifier in the selector.
Returns:
Result of evaluating the selector.
See Also:
getIdentifiers()

eval

public Result eval(IValueProvider provider,
                   java.lang.Object corr)
Evaluate the selector.

Specified by:
eval in interface ISelector
Parameters:
provider - Value provider. During evaluation of the selector callbacks are made on the value provider to get identifier values.
corr - Correlation data. Passed as-is to the value provider.
Returns:
Result of evaluating the selector.

getIdentifiers

public java.util.Map getIdentifiers()
Get identifiers used by the selector. The key into the Map is the name of the identifier and the value is an instance of Identifier.

Specified by:
getIdentifiers in interface ISelector
Returns:
Readonly Map of identifiers that are used within the selector.
Throws:
java.lang.UnsupportedOperationException
See Also:
eval(Map)

getSelector

public java.lang.String getSelector()
Get the selector.

Specified by:
getSelector in interface ISelector
Returns:
Selector.

toString

public java.lang.String toString()
Get selector parse tree.

Returns:
Selector parse tree.


Copyright © 2002-2006 CodeStreet. All Rights Reserved.