Package org.springframework.classify
Class BackToBackPatternClassifier<C,T>
java.lang.Object
org.springframework.classify.BackToBackPatternClassifier<C,T>
- Type Parameters:
C
- the type of thing to classifyT
- the output of the classifier
- All Implemented Interfaces:
Serializable
,Classifier<C,
T>
A special purpose
Classifier
with easy configuration options for mapping from
one arbitrary type of object to another via a pattern matcher.- Author:
- Dave Syer
- See Also:
-
Constructor Summary
ConstructorDescriptionDefault constructor, provided as a convenience for people using setter injection.BackToBackPatternClassifier
(Classifier<C, String> router, Classifier<String, T> matcher) Set up a classifier with input to the router and output from the matcher. -
Method Summary
Modifier and TypeMethodDescriptionClassify 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
(Map<String, T> map) A convenience method for creating a pattern matching classifier for the matcher component.void
setRouterDelegate
(Object delegate) A convenience method of creating a router classifier based on a plain old Java Object.
-
Constructor Details
-
BackToBackPatternClassifier
public BackToBackPatternClassifier()Default constructor, provided as a convenience for people using setter injection. -
BackToBackPatternClassifier
Set up a classifier with input to the router and output from the matcher.- Parameters:
router
- seesetRouterDelegate(Object)
matcher
- seesetMatcherMap(Map)
-
-
Method Details
-
setMatcherMap
A convenience method for creating a pattern matching classifier for the matcher component.- Parameters:
map
- maps pattern keys with wildcards to output values
-
setRouterDelegate
A convenience method of creating a router classifier based on a plain old Java Object. The object provided must have precisely one public method that either has the@Classifier
annotation or accepts a single argument and outputs a String. This will be used to create an input classifier for the router component.- Parameters:
delegate
- the delegate object used to create a router classifier
-
classify
Classify the input and map to a String, then take that and put it into a pattern matcher to match to an output value.- Specified by:
classify
in interfaceClassifier<C,
T> - Parameters:
classifiable
- the input object. Can be null.- Returns:
- an object. Can be null, but implementations should declare if this is the case.
-