|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.collections4.functors.ConstantTransformer<I,O>
public class ConstantTransformer<I,O>
Transformer implementation that returns the same constant each time.
No check is made that the object is immutable. In general, only immutable objects should use the constant factory. Mutable objects should use the prototype factory.
Field Summary | |
---|---|
static Transformer<Object,Object> |
NULL_INSTANCE
Returns null each time |
Constructor Summary | |
---|---|
ConstantTransformer(O constantToReturn)
Constructor that performs no validation. |
Method Summary | ||
---|---|---|
static
|
constantTransformer(O constantToReturn)
Transformer method that performs validation. |
|
boolean |
equals(Object obj)
|
|
O |
getConstant()
Gets the constant. |
|
int |
hashCode()
|
|
static
|
nullTransformer()
Get a typed null instance. |
|
O |
transform(I input)
Transforms the input by ignoring it and returning the stored constant instead. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final Transformer<Object,Object> NULL_INSTANCE
Constructor Detail |
---|
public ConstantTransformer(O constantToReturn)
constantTransformer
if you want that.
constantToReturn
- the constant to return each timeMethod Detail |
---|
public static <I,O> Transformer<I,O> nullTransformer()
I
- the input typeO
- the output type
public static <I,O> Transformer<I,O> constantTransformer(O constantToReturn)
I
- the input typeO
- the output typeconstantToReturn
- the constant object to return each time in the factory
constant
factory.public O transform(I input)
transform
in interface Transformer<I,O>
input
- the input object which is ignored
public O getConstant()
public boolean equals(Object obj)
equals
in class Object
public int hashCode()
hashCode
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |