public final class FactoryBuilder extends Object
Factory
instances.
Factory
is used by MutableConfiguration
to avoid adding
non-Serializable instances that would assume usage in the local JVM.
Two styles of builder are available:
Factory instances can also be created in other ways.Modifier and Type | Class | Description |
---|---|---|
static class |
FactoryBuilder.ClassFactory<T> |
A
Factory that instantiates a specific Class. |
static class |
FactoryBuilder.SingletonFactory<T> |
A
Factory that always returns a specific instance. |
Modifier and Type | Method | Description |
---|---|---|
static <T> Factory<T> |
factoryOf(Class<T> clazz) |
Constructs a
Factory that will produce factory instances of the
specified class. |
static <T> Factory<T> |
factoryOf(String className) |
Constructs a
Factory that will produce factory instances of the
specified class. |
static <T extends Serializable> |
factoryOf(T instance) |
Constructs a
Factory that will return the specified factory
Serializable instance. |
public static <T> Factory<T> factoryOf(Class<T> clazz)
Factory
that will produce factory instances of the
specified class.
The specified class must have a no-args constructor.
public static <T> Factory<T> factoryOf(String className)
Factory
that will produce factory instances of the
specified class.
The specified class must have a no-args constructor.
public static <T extends Serializable> Factory<T> factoryOf(T instance)
Factory
that will return the specified factory
Serializable instance.
If T is not Serializable use factoryOf(Class)
or
factoryOf(String)
.
Copyright © 2017. All rights reserved.