|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.smartics.util.util.GenericServiceFactory<T>
T
- the type of the created instance.
public final class GenericServiceFactory<T>
A factory to create instances of a given type via META-INF/services
.
Constructor Summary | |
---|---|
GenericServiceFactory(Class<T> type) Convenience constructor for lenient creation. |
|
GenericServiceFactory(Class<T> type, boolean lenient) Default constructor. |
Method Summary | |
---|---|
T |
create() Creates an instance of the type provided with the constructor using the configuration of the service in META-INF/services in the mode passed to the constructor. |
T |
create(boolean lenient) Creates an instance of the type provided with the constructor using the configuration of the service in META-INF/services . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GenericServiceFactory(Class<T> type) throws NullPointerException
type
- the type of instances to be created.
NullPointerException
- if
type
is
null
.
public GenericServiceFactory(Class<T> type, boolean lenient) throws NullPointerException
type
- the type of instances to be created.
lenient
- the default mode to create instances.
NullPointerException
- if
type
is
null
.
Method Detail |
---|
public T create() throws IllegalStateException
META-INF/services
in the mode passed to the constructor.
IllegalStateException
- if no instance has been loaded successfully.
public T create(boolean lenient) throws IllegalStateException
META-INF/services
.
lenient
- if more than one instance has been found or loading a redundant instance encountered problems, a value of
true
will only issue a warning, while
false
will throw an
IllegalStateException
.
IllegalStateException
- if no instance has been loaded successfully.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |