public class ContextFactory
extends java.lang.Object
Context
.Constructor and Description |
---|
ContextFactory()
Creates a new instance using a default context implementation
|
ContextFactory(Context context)
Creates a new instance using the given context implementation
|
Modifier and Type | Method and Description |
---|---|
Context |
context()
Returns the context used by this factory.
|
<E> E |
create(java.lang.Class<E> type)
Creates a new instance of the given type by looping through its public
constructors to find one which all parameters are resolved by the context.
|
static java.util.function.BiFunction<java.lang.reflect.Constructor,java.lang.Object[],java.lang.Object> |
defaults()
The default function to create objects.
|
ContextFactory |
toCreate(java.util.function.BiFunction<java.lang.reflect.Constructor,java.lang.Object[],java.lang.Object> function)
Changes the way the objects are created by using the given function.
|
public ContextFactory()
public ContextFactory(Context context)
context
- the context to usepublic Context context()
public ContextFactory toCreate(java.util.function.BiFunction<java.lang.reflect.Constructor,java.lang.Object[],java.lang.Object> function)
function
- the function to use for creating the objects.public <E> E create(java.lang.Class<E> type)
type
- the type of the object to create.CreateException
- if the object cannot be createdpublic static java.util.function.BiFunction<java.lang.reflect.Constructor,java.lang.Object[],java.lang.Object> defaults()