public class BackToBackPatternClassifier<C,T> extends java.lang.Object implements Classifier<C,T>
Classifier with easy configuration options for
mapping from one arbitrary type of object to another via a pattern matcher.| Modifier and Type | Field and Description |
|---|---|
private Classifier<java.lang.String,T> |
matcher |
private Classifier<C,java.lang.String> |
router |
| Constructor and Description |
|---|
BackToBackPatternClassifier()
Default constructor, provided as a convenience for people using setter
injection.
|
BackToBackPatternClassifier(Classifier<C,java.lang.String> router,
Classifier<java.lang.String,T> matcher)
Set up a classifier with input to the router and output from the matcher.
|
| Modifier and Type | Method and Description |
|---|---|
T |
classify(C classifiable)
Classify the input and map to a String, then take that and put it into a
pattern matcher to match to an output value.
|
void |
setMatcherMap(java.util.Map<java.lang.String,T> map)
A convenience method for creating a pattern matching classifier for the
matcher component.
|
void |
setRouterDelegate(java.lang.Object delegate)
A convenience method of creating a router classifier based on a plain old
Java Object.
|
private Classifier<C,java.lang.String> router
private Classifier<java.lang.String,T> matcher
public BackToBackPatternClassifier()
public BackToBackPatternClassifier(Classifier<C,java.lang.String> router, Classifier<java.lang.String,T> matcher)
router - see setRouterDelegate(Object)matcher - see setMatcherMap(Map)public void setMatcherMap(java.util.Map<java.lang.String,T> map)
map - maps pattern keys with wildcards to output valuespublic void setRouterDelegate(java.lang.Object delegate)
@Classifier annotation or accepts a single argument
and outputs a String. This will be used to create an input classifier for
the router component. delegate - the delegate object used to create a router classifierpublic T classify(C classifiable)
classify in interface Classifier<C,T>classifiable - the input object. Can be null.