public class ConstantFactory extends java.lang.Object implements Factory, 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 and Description |
---|---|
static Factory |
NULL_INSTANCE
Returns null each time
|
Constructor and Description |
---|
ConstantFactory(java.lang.Object constantToReturn)
Constructor that performs no validation.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
create()
Always return constant.
|
java.lang.Object |
getConstant()
Gets the constant.
|
static Factory |
getInstance(java.lang.Object constantToReturn)
Factory method that performs validation.
|
public static final Factory NULL_INSTANCE
public ConstantFactory(java.lang.Object constantToReturn)
getInstance
if you want that.constantToReturn
- the constant to return each timepublic static Factory getInstance(java.lang.Object constantToReturn)
constantToReturn
- the constant object to return each time in the factoryconstant
factory.public java.lang.Object create()
public java.lang.Object getConstant()
Copyright © 2010 - 2020 Adobe. All Rights Reserved