T
- the class of the resolved objectpublic interface TermResolver<T>
An TermResolver
implementor is a utility class used for resolution (reification) of fact values for one or
moreTerm
s. There are a few key concepts to understand how TermResolver
s function and work together.
Term
s (which must not have any parameters). If they do, when the TermResolutionEngine
calls
resolve(Map, Map)
it will pass the resolved prerequisites in the first argument.
TermResolutionEngine
has TermResolver
s (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.getParameterNames()
method. All declared parameters are considered to be required. Parameters can be set
on the Term
(via the constructor) that you are asking to resolve. When the TermResolutionEngine
calls
resolve(Map, Map)
, the parameters will be passed in to the second argument.TermResolver
s 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
the TermResolutionEngine
has TermResolver
s (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.Modifier and Type | Method and Description |
---|---|
int |
getCost()
Gets an int representing the cost of resolving the term.
|
String |
getOutput()
Gets the name of the term that this TermResolver resolves.
|
Set<String> |
getParameterNames()
Gets the names of any parameters that this
TermResolver requires to resolve Term s. |
Set<String> |
getPrerequisites()
Gets the names of the terms that this resolver requires in order to be able to resolve its output,
or an empty set if it has no prereqs;
|
T |
resolve(Map<String,Object> resolvedPrereqs,
Map<String,String> parameters)
Resolves the output term's fact value given the resolved prerequisite terms and term parameters.
|
Set<String> getPrerequisites()
String getOutput()
Set<String> getParameterNames()
TermResolver
requires to resolve Term
s.
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.int getCost()
T resolve(Map<String,Object> resolvedPrereqs, Map<String,String> parameters) throws TermResolutionException
resolvedPrereqs
- the resolved prereqs. May be empty, but never null.parameters
- any parameters on the Term
to be resolved (which must match those declared via
getParameterNames()
. May be empty, but never null.Term
. May be null.{@link
- TermResolutionException} if something bad happens during the term resolution process.TermResolutionException
Copyright © 2005-2015 The Kuali Foundation. All Rights Reserved.