T
- the type of object that this factory creates@FunctionalInterface public interface Factory<T>
Modifier and Type | Method and Description |
---|---|
static <T> Factory<T> |
constant(T item)
Creates a factory that always returns the given item.
|
T |
create()
Creates a new object.
|
T create() throws Exception
Exception
- anystatic <T> Factory<T> constant(T item)
T
- the type of the itemitem
- the item to always provideitem