|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectinfo.monitorenter.cpdetector.reflect.SingletonLoader
public final class SingletonLoader
A stateless helper that performs dynamic class loading and instantiation with support for invoking Singleton-retrieval methods of classes if detected.
Before invoking someClass.newInstance() the loaded class is inspected for methods, that are public,
static, parameterless, contain the substring "intance" in their name (case-insensitive) and return an instance of the
same type.
If such a method is found, it is considered to be a singleton retrieval method and will be invoked instead of trying
to use the default constructor triggered by newInstance() (which then should be private if it is
really a singleton.
This class is in turn a singleton as it only contains procedural code. For possible desireable future configuration requirements, the single public method is not declared static but bound to the singleton instance.
| Method Summary | |
|---|---|
static SingletonLoader |
getInstance()
|
Object |
newInstance(Class c)
Dynamic instantiation of the given type with singleton retrieval support as described in this class description. |
Object |
newInstance(String fullyQualifiedClassName)
High-level method for instantiation of a new instance of the class specified by the given fully qualified class name with singleton retrieval support. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static SingletonLoader getInstance()
public Object newInstance(String fullyQualifiedClassName)
throws InstantiationException,
IllegalAccessException,
ClassNotFoundException
newInstance(Class).
InstantiationException
IllegalAccessException
ClassNotFoundException
public Object newInstance(Class c)
throws InstantiationException,
IllegalAccessException
InstantiationException
IllegalAccessException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||