org.kuali.rice.krms.api.engine
Interface TermResolver<T>
- Type Parameters:
- T- the class of the resolved object
- public interface TermResolver<T> 
An TermResolver implementor is a utility class used for resolution (reification) of Terms.  There are a
 few key concepts to understand how TermResolvers function and work together.
 
 
 - they can require prerequisite Terms (which must not have any parameters).  If they do, when theTermResolutionEnginecallsresolve(Map, Map)it will pass the resolved prerequisites in the first argument.
- they can be chained.  This means that if the TermResolutionEnginehasTermResolvers (a <- b) and 
 (b <- c), and you have the fact 'c', you can ask for term 'a' and the engine will chain the resolvers together
 to resolve it correctly.
- they can be parameterized. If an TermResolver takes parameters, they must be declared via the
 getParameterNames()method.  All declared parameters are considered to be required.  Parameters can be set
 on theTerm(via the constructor) that you are asking to resolve. When theTermResolutionEnginecallsresolve(Map, Map), the parameters will be passed in to the second argument.
- Parameterized TermResolvers can not be intermediates in a resolution plan.  Another way to say 
 this is that they can only be the last resolver in a chain.  For example, say
 theTermResolutionEnginehasTermResolvers (a <- b) which takes no parameters, 
 (b <- c) which takes a parameter "foo", and you have the fact 'c'.  If you ask for Term 'a', the engine will not be able to resolve
 it because it would need to use a parameterized Term as an intermediate step in resolution, and that isn't allowed.
- Author:
- Kuali Rice Team (rice.collab@kuali.org)
 
getPrerequisites
Set<String> getPrerequisites()
- 
- Returns:
- the names of the terms that this resolver requires to resolve its output, or an empty set if it has no prereqs;
 
getOutput
String getOutput()
- 
- Returns:
- the name of the term that the implementor resolves
 
getParameterNames
Set<String> getParameterNames()
- 
- Returns:
- the names of any parameters that this TermResolverrequires to churn out values for multipleTerms.  This may 
 be null if no parameters are required.  If this is non-null/non-empty, then this resolver can not be used as an intermediate
 in a term resolution chain.
 
getCost
int getCost()
- 
- Returns:
- an integer representing the cost of resolving the term. 1 is cheap, Integer.MAX_INT is expensive.
 
resolve
T resolve(Map<String,Object> resolvedPrereqs,
          Map<String,String> parameters)
          throws TermResolutionException
- 
- Parameters:
- resolvedPrereqs- the resolved prereqs
- parameters- any parameters on the- Termto be resolved (which must match those declared via- getParameterNames()
- Returns:
- the resolved fact value for the specified Term
- Throws:
- TermResolutionException- if something bad happens during the term resolution process
 
Copyright © 2005-2011 The Kuali Foundation. All Rights Reserved.