|
JIDE Common Layer 2.7.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jidesoft.converter.CacheMap<T,K>
public class CacheMap<T,K>
CacheMap
is a two-level HashMap
. It uses Class as the key and you can map the key to an
object and a context as a pair. We use context because we want to register multiple objects with the same Class.
register(Class,Object,Object)
is the method to register a new entry. getRegisteredObject(Class,Object)
will allow you to look up the object by specifying the Class and the context.
Field Summary | |
---|---|
protected javax.swing.event.EventListenerList |
listenerList
List of listeners |
Constructor Summary | |
---|---|
CacheMap(K defaultContext)
Constructs a CacheMap . |
Method Summary | |
---|---|
void |
addRegistrationListener(RegistrationListener l)
Adds a listener to the list that's notified each time a change to the registration occurs. |
void |
clear()
|
void |
fireRegistrationChanged(RegistrationEvent e)
Forwards the given notification event to all RegistrationListeners that registered themselves as
listeners for this table model. |
protected com.jidesoft.converter.CacheMap.Cache<K,T> |
getCache(java.lang.Class<?> clazz)
|
K[] |
getKeys(java.lang.Class<?> clazz,
K[] a)
Gets the secondary keys that are registered with the class in CacheMap. |
T |
getMatchRegisteredObject(java.lang.Class<?> clazz,
K context)
Gets the exact match registered object. |
T |
getRegisteredObject(java.lang.Class<?> clazz,
K context)
Gets registered object from CacheMap. |
RegistrationListener[] |
getRegistrationListeners()
Returns an array of all the registration listeners registered on this registration. |
java.util.List<T> |
getValues()
|
protected com.jidesoft.converter.CacheMap.Cache<K,T> |
initCache(java.lang.Class<?> clazz)
|
void |
register(java.lang.Class<?> clazz,
T object,
K context)
Registers an object with the specified clazz and object. |
void |
removeRegistrationListener(RegistrationListener l)
Removes a listener from the list that's notified each time a change to the registration occurs. |
void |
unregister(java.lang.Class<?> clazz,
K context)
Unregisters the object associated with the specified class and context. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected javax.swing.event.EventListenerList listenerList
Constructor Detail |
---|
public CacheMap(K defaultContext)
CacheMap
.
defaultContext
- the default context.Method Detail |
---|
protected com.jidesoft.converter.CacheMap.Cache<K,T> getCache(java.lang.Class<?> clazz)
public K[] getKeys(java.lang.Class<?> clazz, K[] a)
clazz
- the classa
- the array to receive the keys.
protected com.jidesoft.converter.CacheMap.Cache<K,T> initCache(java.lang.Class<?> clazz)
public void register(java.lang.Class<?> clazz, T object, K context)
clazz
- the class which is used as the key.object
- the object, or the value of the mappingcontext
- the secondary key. It is used to register multiple objects to the same primary key (the clazz
parameter in this case).public void unregister(java.lang.Class<?> clazz, K context)
clazz
- the classcontext
- the contextpublic T getRegisteredObject(java.lang.Class<?> clazz, K context)
clazz
- the class which is used as the primary key.context
- the context which is used as the secondary key. This parameter could be null in which case the
default context is used.
public T getMatchRegisteredObject(java.lang.Class<?> clazz, K context)
getRegisteredObject(Class, Object)
which will try
different context and super classes and interfaces to find match. This method will do an exact match.
clazz
- the class which is used as the primary key.context
- the context which is used as the secondary key. This parameter could be null in which case the
default context is used.
public java.util.List<T> getValues()
public void clear()
public void addRegistrationListener(RegistrationListener l)
l
- the RegistrationListenerpublic void removeRegistrationListener(RegistrationListener l)
l
- the RegistrationListenerpublic RegistrationListener[] getRegistrationListeners()
RegistrationListener
s or an empty array if no registration
listeners are currently registeredaddRegistrationListener(com.jidesoft.converter.RegistrationListener)
,
removeRegistrationListener(com.jidesoft.converter.RegistrationListener)
public void fireRegistrationChanged(RegistrationEvent e)
RegistrationListeners
that registered themselves as
listeners for this table model.
e
- the event to be forwardedaddRegistrationListener(com.jidesoft.converter.RegistrationListener)
,
RegistrationEvent
,
EventListenerList
|
JIDE Common Layer 2.7.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |