Package org.apache.commons.collections4
Interface Factory<T>
-
- Type Parameters:
T
- the type that the factory creates
- All Known Implementing Classes:
ConstantFactory
,ExceptionFactory
,InstantiateFactory
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface Factory<T>
Defines a functor interface implemented by classes that create objects.A
Factory
creates an object without using an input parameter. If an input parameter is required, thenTransformer
is more appropriate.Standard implementations of common factories are provided by
FactoryUtils
. These include factories that return a constant, a copy of a prototype or a new instance.- Since:
- 2.1
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description T
create()
Create a new object.
-
-
-
Method Detail
-
create
T create()
Create a new object.- Returns:
- a new object
- Throws:
FunctorException
- (runtime) if the factory cannot create an object
-
-