Class ConstantFactory<T>
java.lang.Object
org.apache.commons.collections4.functors.ConstantFactory<T>
- Type Parameters:
- T- the type of results supplied by this supplier.
- All Implemented Interfaces:
- Serializable,- Supplier<T>,- Factory<T>
Factory 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.
- Since:
- 3.0
- See Also:
- 
Field SummaryFields
- 
Constructor SummaryConstructorsConstructorDescriptionConstantFactory(T constantToReturn) Constructor that performs no validation.
- 
Method SummaryModifier and TypeMethodDescriptionstatic <T> Factory<T> constantFactory(T constantToReturn) Factory method that performs validation.create()Always return constant.Gets the constant.
- 
Field Details- 
NULL_INSTANCEReturns null each time
 
- 
- 
Constructor Details- 
ConstantFactoryConstructor that performs no validation. UseconstantFactoryif you want that.- Parameters:
- constantToReturn- the constant to return each time
 
 
- 
- 
Method Details- 
constantFactoryFactory method that performs validation.- Type Parameters:
- T- the type of the constant
- Parameters:
- constantToReturn- the constant object to return each time in the factory
- Returns:
- the constantfactory.
 
- 
create
- 
getConstant
 
-