|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--iaik.utils.Factory
This class can be used to manage classes for dynamic instanziation.
Field Summary | |
protected static Hashtable |
interfaces
Repository of known interfaces. |
protected static Hashtable |
singletons
Repository of Singleton instances. |
Constructor Summary | |
protected |
Factory()
Restrict instantiation to the class itself and subclasses. |
Method Summary | |
protected abstract Object |
create(Class implementation)
Creates a new instance of the given class. |
protected Object |
create(Class iface,
Object type,
boolean singleton)
Create an instance using the given interface and type. |
protected void |
register(Class iface,
Object type,
Class implementation)
Register a class to implement one type of a specific interface. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static Hashtable interfaces
protected static Hashtable singletons
Constructor Detail |
protected Factory()
Method Detail |
protected abstract Object create(Class implementation) throws InstantiationException, IllegalAccessException
implementation.newInstance()
.implementation
- the implementation class to be instantiatedInstantiationException
- Thrown when an application tries to create an instance
of a class using the newInstance method in class Class,
but the specified class object cannot be instantiated
because it is an interface or is an abstract class.IllegalAccessException
- if an attempt was made to instantiate a of a foreign
package not supporting foreign instantiationprotected Object create(Class iface, Object type, boolean singleton) throws InstantiationException
iface
- the desired interface class the type belongs totype
- an object denoting indirectly which concrete
class should be used when instantiatingsingleton
- boolean denoting weather a shared instance
should be usedInstantiationException
- if new instance couldn't be createdprotected void register(Class iface, Object type, Class implementation)
int hashCode()
from java.lang.Object to use
it with Hashtables.iface
- the desired interface class the type belongs totype
- an Object used to distinguish the different implementationsimplementation
- The implementation class being registered
|
This Javadoc may contain text parts from Internet Standard specifications (RFC 2459, 3280, 3039, 2560, 1521, 821, 822, 2253, 1319, 1321, ,2630, 2631, 2268, 3058, 2984, 2104, 2144, 2040, 2311, 2279, see copyright note) and RSA Data Security Public-Key Cryptography Standards (PKCS#1,3,5,7,8,9,10,12, see copyright note). | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |