org.syphr.prom
Interface Evaluator

All Known Implementing Classes:
DefaultEvaluator

public interface Evaluator

This interface defines an object that can interrogate a raw value to determine if it references other values and provide information about those references. Most importantly, it can translate a raw value into a fully evaluated value.

Author:
Gregory P. Moyer

Method Summary
 String evaluate(String rawValue, Retriever retriever)
          Transform the given raw value into a fully evaluated value (including recursively nested references).
 List<Reference> getReferences(String rawValue, Retriever retriever)
          Get a list of references contained within the given raw value.
 boolean isReferencing(String rawValue, String name, Retriever retriever)
          Determine whether or not the given raw value references another value by name.
 Reference referenceAt(String rawValue, int position, Retriever retriever)
          Retrieve the reference at the specified location, if one exists.
 

Method Detail

evaluate

String evaluate(String rawValue,
                Retriever retriever)
Transform the given raw value into a fully evaluated value (including recursively nested references).

Parameters:
rawValue - the raw value, which may contain references to other values
retriever - the retriever used to obtain the values of referenced properties
Returns:
the fully evaluated value

referenceAt

Reference referenceAt(String rawValue,
                      int position,
                      Retriever retriever)
Retrieve the reference at the specified location, if one exists.

Parameters:
rawValue - the raw value that may or may not contain a reference
position - the position at which to look for a reference - this does not need to be the beginning of the reference or any other particular position relative to the reference, if a reference exists that contains this location in the raw value, it will be returned
retriever - the Retriever used to get the value of the reference, if one is found
Returns:
the reference at the given location, if such a reference exists; null otherwise

isReferencing

boolean isReferencing(String rawValue,
                      String name,
                      Retriever retriever)
Determine whether or not the given raw value references another value by name. This includes recursively nested references.

Parameters:
rawValue - the raw value to search
name - the name of the reference to find
retriever - the Retriever instance used to convert references to values for recursive searching
Returns:
true if a reference with the given name is found; false otherwise

getReferences

List<Reference> getReferences(String rawValue,
                              Retriever retriever)
Get a list of references contained within the given raw value. The list is not recursive, but each Reference contains a list of sub-references found within its value, so a recursive listing is obtainable.

Parameters:
rawValue - the raw value to search for references
retriever - the Retriever instance used to convert references to values
Returns:
a list of references in the order that they are found when starting with the first character of the raw value and processing through the last character (non-recursive)


Copyright © 2010 Gregory P. Moyer. All Rights Reserved.