|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.japaki.basic.DefaultFactory<T>
public class DefaultFactory<T>
Provides a factory for classes with public default constructors. The implementation is based on reflection.
Constructor Summary | |
---|---|
DefaultFactory()
|
|
DefaultFactory(Class<T> type)
Creates a new factory for the given type. |
Method Summary | ||
---|---|---|
T |
create()
Creates a new instance of type T . |
|
static
|
newInstance(Class<T> type)
Creates a new factory for the given type. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DefaultFactory(Class<T> type) throws InstantiationException, IllegalAccessException
type
- a class with a public default constructor.
NullPointerException
- if type
is null
InstantiationException
- see Class.newInstance()
IllegalAccessException
- see Class.newInstance()
public DefaultFactory()
Method Detail |
---|
public static <T> Factory<T> newInstance(Class<T> type)
type
- a class with a public default constructor.
NullPointerException
- if type
is null
RuntimeException
- if the class could not be instatiated.public T create()
Factory
T
.
create
in interface Factory<T>
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |