|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.classify.PatternMatchingClassifier<T>
public class PatternMatchingClassifier<T>
A Classifier
that maps from String patterns with wildcards to a set
of values of a given type. An input String is matched with the most specific
pattern possible to the corresponding value in an input map. A default value
should be specified with a pattern key of "*".
Constructor Summary | |
---|---|
PatternMatchingClassifier()
Default constructor. |
|
PatternMatchingClassifier(java.util.Map<java.lang.String,T> values)
Create a classifier from the provided map. |
Method Summary | |
---|---|
T |
classify(java.lang.String classifiable)
Classify the input by matching it against the patterns provided in setPatternMap(Map) . |
void |
setPatternMap(java.util.Map<java.lang.String,T> values)
A map from pattern to value |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PatternMatchingClassifier()
public PatternMatchingClassifier(java.util.Map<java.lang.String,T> values)
values
- Method Detail |
---|
public void setPatternMap(java.util.Map<java.lang.String,T> values)
values
- the pattern map to setpublic T classify(java.lang.String classifiable)
setPatternMap(Map)
. The most specific pattern that matches will
be used to locate a value.
classify
in interface Classifier<java.lang.String,T>
classifiable
- the input object. Can be null.
java.lang.IllegalStateException
- if no matching value is found.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |