|
Evaluating Software Design Patterns — the "Gang of Four" patterns implemented in Java 6 |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectdk.rode.thesis.singleton.Main
public class Main
Singleton tests.
| Constructor Summary | |
|---|---|
Main()
No-arg constructor. |
|
| Method Summary | ||
|---|---|---|
private
|
getSingleton(Log out,
SingletonRegistry<T> registry,
Class<S> type,
S singleton)
Tests the singleton object supplied as singleton against the
return instance from registry when looked up using type. |
|
private
|
loadSingleton(Log out,
LoadableSingletonRegistry<T> registry,
String className,
S singleton)
Tests the singleton object supplied as singleton against the
return instance from registry when looked up using type. |
|
static void |
main(String[] args)
Executes the Singleton tests. |
|
boolean |
test(Log out,
Arguments arguments)
Performs the specific tests and report the outcome to the log supplied as log. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Main()
| Method Detail |
|---|
private <T,S extends T> boolean getSingleton(Log out,
SingletonRegistry<T> registry,
Class<S> type,
S singleton)
singleton against the
return instance from registry when looked up using type.
T - The super-type of singleton types supported by registry.S - The actual singleton type to test.out - The log to use; never null.registry - The registry to use to acquire the singleton instance based
on type; never null.type - The type of the singleton object to test; never null.singleton - The known singleton object to test on; never null.
private <T,S extends T> boolean loadSingleton(Log out,
LoadableSingletonRegistry<T> registry,
String className,
S singleton)
singleton against the
return instance from registry when looked up using type.
T - The super-type of singleton types supported by registry.S - The actual singleton type to test.out - The log to use; never null.registry - The registry to use to acquire the singleton instance based
on type; never null.className - The class name of the singleton type to test; never null.singleton - The known singleton object to test on; never null.
public static void main(String[] args)
args - The arguments to supply to test(Log, Arguments),
if any; can be null.
public boolean test(Log out,
Arguments arguments)
Testablelog supplied as log. Arguments to control log-level:
-log: a boolean value (as a string) indicating if
class logging is enabled for relevant classes.
-log.verbose: a boolean value (as a string) indicating
if class logging is enabled for relevant classes that generates
verbose output.
test in interface Testableout - The log to report the test outcome to; cannot be null.arguments - Additional arguments, if any.
|
Gunni Rode / rode.dk | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||