org.apache.commons.collections.functors
Class ConstantFactory
java.lang.Object
org.apache.commons.collections.functors.ConstantFactory
- Factory, Serializable
public class ConstantFactory
extends java.lang.Object
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.
$Revision: 1.5 $ $Date: 2004/05/16 11:47:38 $
ConstantFactory(Object constantToReturn) - Constructor that performs no validation.
|
NULL_INSTANCE
public static final Factory NULL_INSTANCE
Returns null each time
ConstantFactory
public ConstantFactory(Object constantToReturn)
Constructor that performs no validation.
Use getInstance
if you want that.
constantToReturn
- the constant to return each time
create
public Object create()
Always return constant.
- create in interface Factory
- the stored constant value
getConstant
public Object getConstant()
Gets the constant.
getInstance
public static Factory getInstance(Object constantToReturn)
Factory method that performs validation.
constantToReturn
- the constant object to return each time in the factory
Copyright © 2001-2006 Apache Software Foundation. All Rights Reserved.