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 T | iConstant
The closures to call in turn |
| public static final Factory | NULL_INSTANCE
Returns null each time |
| private static final long | serialVersionUID
Serial version UID |
| Access | Constructor and Description |
|---|---|
| public | ConstantFactory(final T
the constant to return each time constantToReturn)Constructor that performs no validation. |
| Modifier and Type | Method and Description |
|---|---|
| public static < the type of the constant T> Factory | Returns: theconstant factory.the constant object to return each time in the factory constantToReturn)Factory method that performs validation. |
| public T | Returns: the stored constant valueImplements org. |
| public T |
| iConstant | back to summary |
|---|---|
| private final T iConstant The closures to call in turn | |
| NULL_INSTANCE | back to summary |
|---|---|
| public static final Factory<T> NULL_INSTANCE Returns null each time
| |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Serial version UID | |
| ConstantFactory | back to summary |
|---|---|
| public ConstantFactory(final T constantToReturn) Constructor that performs no validation.
Use
| |
| constantFactory | back to summary |
|---|---|
| public static <T> Factory Factory method that performs validation.
| |
| create | back to summary |
|---|---|
| public T create() Implements org. Always return constant.
| |
| getConstant | back to summary |
|---|---|
| public T getConstant() Gets the constant.
| |