|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.batch.classify.SubclassClassifier<T,C>
public class SubclassClassifier<T,C>
A Classifier
for a parameterised object type based on a map.
Classifies objects according to their inheritance relation with the supplied
type map. If the object to be classified is one of the keys of the provided
map, or is a subclass of one of the keys, then the map entry value for that
key is returned. Otherwise returns the default value which is null by
default.
Constructor Summary | |
---|---|
SubclassClassifier()
Create a SubclassClassifier with null default value. |
|
SubclassClassifier(C defaultValue)
Create a SubclassClassifier with supplied default value. |
|
SubclassClassifier(Map<Class<? extends T>,C> typeMap,
C defaultValue)
Create a SubclassClassifier with supplied default value. |
Method Summary | |
---|---|
C |
classify(T classifiable)
Return the value from the type map whose key is the class of the given Throwable, or its nearest ancestor if a subclass. |
C |
getDefault()
Return the default value supplied in the constructor (default false). |
void |
setDefaultValue(C defaultValue)
Public setter for the default value for mapping keys that are not found in the map (or their subclasses). |
void |
setTypeMap(Map<Class<? extends T>,C> map)
Set the classifications up as a map. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SubclassClassifier()
SubclassClassifier
with null default value.
public SubclassClassifier(C defaultValue)
SubclassClassifier
with supplied default value.
defaultValue
- public SubclassClassifier(Map<Class<? extends T>,C> typeMap, C defaultValue)
SubclassClassifier
with supplied default value.
defaultValue
- Method Detail |
---|
public void setDefaultValue(C defaultValue)
defaultValue
- the default value to setpublic void setTypeMap(Map<Class<? extends T>,C> map)
map
- a map from type to classpublic C classify(T classifiable)
classify
in interface Classifier<T,C>
classifiable
- the input object. Can be null.
public final C getDefault()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |