|
JAC project AOPSYS CEDRIC & LIP6 labs |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.objectweb.jac.util.Repository
This class can be subclassed to create specific repositories.
A repository class should be a singleton (a sole instance class). Thus, the repository subclasses should define a static field and a static method 'get' that returns the unique repository for the class and that creates it if it does not exist.
Field Summary | |
Map |
names
Reverse hashtable to find an objet from its name |
Map |
objects
Link JAC objects to the names |
protected static Repository |
repository
Store the sole instance of repository. |
Constructor Summary | |
Repository()
|
Method Summary | |
void |
dump()
Dump all the registered objects. |
static Repository |
get()
Get the sole repository instance for this class. |
String |
getName(Object object)
Returns the name of a registered object. |
Object[] |
getNames()
Return the names of the registered objects as an array. |
Object |
getObject(String logicalName)
Return a registered object for a given logical name. |
Object[] |
getObjects()
Return all the registered objects as an array. |
String |
getPrintableString()
|
boolean |
isRegistered(String logicalName)
Returns true if an object is registered with this name. |
boolean |
register(String logicalName,
Object object)
Register a new object into the repository. |
void |
unregister(String logicalName)
Unregister a JacObject from the repository. |
void |
unregisterObject(Object object)
Unregister a JacObject from the repository. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static Repository repository
NOTE: this field MUST be defined by all subclasses.
get()
public Map objects
public Map names
Constructor Detail |
public Repository()
Method Detail |
public static Repository get()
NOTE: this method MUST be defined by all subclasses.
public boolean register(String logicalName, Object object)
logicalName
- the key that allows to find the objectobject
- the object to register
unregister(String)
public void unregister(String logicalName)
logicalName
- the key that allows to find the objectregister(String,Object)
,
unregisterObject(Object)
public void unregisterObject(Object object)
object
- the object to unregisterregister(String,Object)
,
unregister(String)
public boolean isRegistered(String logicalName)
logicalName
- the key that allows to find the objectregister(String,Object)
public Object[] getObjects()
Reverse operation is getNames()
.
register(String,Object)
,
getNames()
public Object[] getNames()
Reverse operation is getObjects()
.
register(String,Object)
,
getObjects()
public Object getObject(String logicalName)
Return null
if the name does not correspond to
any registered object or if logicalName
is null.
Reverse operation is getName(Object)
.
logicalName
- the key that allows to find the object
register(String,Object)
,
getName(Object)
public String getName(Object object)
Reverse operation is getObject(String)
.
object
- the object to get the name of
register(String,Object)
,
getObject(String)
public void dump()
public String getPrintableString()
|
Contact JAC development team: Renaud Pawlak Lionel Seinturier Laurent Martelli |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |