C
- the type of the thing to classifyT
- the output of the classifierpublic class ClassifierAdapter<C,T> extends Object implements Classifier<C,T>
Classifier
interface.Constructor and Description |
---|
ClassifierAdapter()
Default constructor for use with setter injection.
|
ClassifierAdapter(Classifier<C,T> delegate)
Create a new
Classifier from the delegate provided. |
ClassifierAdapter(Object delegate)
Create a new
Classifier from the delegate provided. |
Modifier and Type | Method and Description |
---|---|
T |
classify(C classifiable)
Classify the given object and return an object of a different type, possibly an
enumerated type.
|
void |
setDelegate(Classifier<C,T> delegate) |
void |
setDelegate(Object delegate)
Search for the
Classifier annotation on a method in the supplied delegate and use that to create
a Classifier from the parameter type to the return type. |
public ClassifierAdapter()
public ClassifierAdapter(Object delegate)
Classifier
from the delegate provided. Use the constructor as
an alternative to the setDelegate(Object)
method.delegate
- the delegatepublic ClassifierAdapter(Classifier<C,T> delegate)
Classifier
from the delegate provided. Use the constructor as
an alternative to the setDelegate(Classifier)
method.delegate
- the classifier to delegate topublic void setDelegate(Classifier<C,T> delegate)
public final void setDelegate(Object delegate)
Classifier
annotation on a method in the supplied delegate and use that to create
a Classifier
from the parameter type to the return type. If the annotation
is not found a unique non-void method with a single parameter will be used, if it
exists. The signature of the method cannot be checked here, so might be a runtime
exception when the method is invoked if the signature doesn't match the classifier
types.delegate
- an object with an annotated methodpublic T classify(C classifiable)
classify
in interface Classifier<C,T>
classifiable
- the input object. Can be null.Copyright © 2021 SpringSource. All rights reserved.