java.io.Serializable, Transformer<I,O>public class ConstantTransformer<I,O> extends java.lang.Object implements Transformer<I,O>, java.io.Serializable
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.
| Modifier and Type | Field | Description |
|---|---|---|
static Transformer |
NULL_INSTANCE |
Returns null each time
|
| Constructor | Description |
|---|---|
ConstantTransformer(O constantToReturn) |
Constructor that performs no validation.
|
| Modifier and Type | Method | Description |
|---|---|---|
static <I,O> Transformer<I,O> |
constantTransformer(O constantToReturn) |
Transformer method that performs validation.
|
boolean |
equals(java.lang.Object obj) |
|
O |
getConstant() |
Gets the constant.
|
int |
hashCode() |
|
static <I,O> Transformer<I,O> |
nullTransformer() |
Get a typed null instance.
|
O |
transform(I input) |
Transforms the input by ignoring it and returning the stored constant instead.
|
public static final Transformer NULL_INSTANCE
public ConstantTransformer(O constantToReturn)
constantTransformer if you want that.constantToReturn - the constant to return each timepublic static <I,O> Transformer<I,O> nullTransformer()
I - the input typeO - the output typepublic 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 factoryconstant factory.public O transform(I input)
transform in interface Transformer<I,O>input - the input object which is ignoredpublic O getConstant()
public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.ObjectCopyright © 2001-2019 - Apache Software Foundation