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 and Description |
|---|---|
| private final O | iConstant
The closures to call in turn |
| public static final Transformer | NULL_INSTANCE
Returns null each time |
| private static final long | serialVersionUID
Serial version UID |
| Access | Constructor and Description |
|---|---|
| public | ConstantTransformer(final O
the constant to return each time constantToReturn)Constructor that performs no validation. |
| Modifier and Type | Method and Description |
|---|---|
| public static < the input type I, the output type O> Transformer | Returns: theconstant factory.the constant object to return each time in the factory constantToReturn)Transformer method that performs validation. |
| public boolean | equals(final Object
the reference object with which to compare. obj)Overrides java. |
| public O | |
| public int | |
| public static < the input type I, the output type O> Transformer | |
| public O | Returns: the stored constantthe input object which is ignored input)Implements org. |
| iConstant | back to summary |
|---|---|
| private final O iConstant The closures to call in turn | |
| NULL_INSTANCE | back to summary |
|---|---|
| public static final Transformer<I, O> NULL_INSTANCE Returns null each time
| |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Serial version UID | |
| ConstantTransformer | back to summary |
|---|---|
| public ConstantTransformer(final O constantToReturn) Constructor that performs no validation.
Use
| |
| constantTransformer | back to summary |
|---|---|
| public static <I, O> Transformer Transformer method that performs validation.
| |
| equals | back to summary |
|---|---|
| public boolean equals(final Object obj) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes. | |
| getConstant | back to summary |
|---|---|
| public O getConstant() Gets the constant.
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for the object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| nullTransformer | back to summary |
|---|---|
| public static <I, O> Transformer Get a typed null instance.
| |
| transform | back to summary |
|---|---|
| public O transform(final I input) Implements org. Transforms the input by ignoring it and returning the stored constant instead.
| |