程序包 infra.classify
类 PatternMatchingClassifier<T>
java.lang.Object
infra.classify.PatternMatchingClassifier<T>
- 类型参数:
T
- the output of the classifier
- 所有已实现的接口:
Classifier<String,
,T> Serializable
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 "*".- 作者:
- Dave Syer
- 另请参阅:
-
字段概要
字段 -
构造器概要
构造器构造器说明Default constructor.PatternMatchingClassifier
(Map<String, T> values) Create a classifier from the provided map. -
方法概要
修饰符和类型方法说明Classify the input by matching it against the patterns provided insetPatternMap(Map)
.void
setPatternMap
(Map<String, T> values) A map from pattern to value
-
字段详细资料
-
values
-
-
构造器详细资料
-
PatternMatchingClassifier
public PatternMatchingClassifier()Default constructor. Use the setter or the other constructor to create a sensible classifier, otherwise all inputs will cause an exception. -
PatternMatchingClassifier
Create a classifier from the provided map. The keys are patterns, using '?' as a single character and '*' as multi-character wildcard.- 参数:
values
- the values to use in thePatternMatcher
-
-
方法详细资料
-
setPatternMap
A map from pattern to value- 参数:
values
- the pattern map to set
-
classify
Classify the input by matching it against the patterns provided insetPatternMap(Map)
. The most specific pattern that matches will be used to locate a value.- 指定者:
classify
在接口中Classifier<String,
T> - 参数:
classifiable
- the input object. Can be null.- 返回:
- the value matching the most specific pattern possible
- 抛出:
IllegalStateException
- if no matching value is found.
-