|
Project Wonder 5.0.0.8795 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objecter.extensions.eof.ERXEnterpriseObjectArrayCache<T>
public class ERXEnterpriseObjectArrayCache<T extends EOEnterpriseObject>
Caches objects of one entity by a given key. Listens to
EOEditingContextDidSaveChanges notifications to track changes.
Typically you'd fetch values by:
You can supply a timeout after which the cache is to get cleared and all the objects refetched. Note
that this implementation only caches the global IDs, not the actual data.
ERXEnterpriseObjectArrayCache<HelpText> helpTextCache = new ERXEnterpriseObjectArrayCache<HelpText>("HelpText") {
protected void handleUnsuccessfullQueryForKey(Object key) {
NSArray helpTexts = ... fetch from somewhere
setObjectsForKey(helpTexts, key);
}
};
...
NSArray<HelpText> helpTexts = helpTextCache.objectsForKey(ec, "AllTexts");
...
| Nested Class Summary | |
|---|---|
static class |
ERXEnterpriseObjectArrayCache.NotFoundArray
|
| Field Summary | |
|---|---|
protected static NSArray |
NOT_FOUND_MARKER
|
| Constructor Summary | |
|---|---|
ERXEnterpriseObjectArrayCache(Class c)
Creates the cache for the given entity name and the given keypath. |
|
ERXEnterpriseObjectArrayCache(String entityName)
Creates the cache for the given entity name and the given keypath. |
|
ERXEnterpriseObjectArrayCache(String entityName,
long timeout)
Creates the cache for the given entity, keypath and timeout value in milliseconds. |
|
| Method Summary | |
|---|---|
protected NSArray<EOGlobalID> |
cachedArrayForKey(Object key)
|
void |
clearCaches(NSNotification n)
Handler for the clearCaches notification. |
void |
editingContextDidSaveChanges(NSNotification n)
Handler for the editingContextDidSaveChanges notification. |
protected String |
entityName()
|
protected static String |
entityNameForClass(Class c)
|
protected long |
fetchTime()
|
protected void |
handleUnsuccessfullQueryForKey(Object key)
Called when a query hasn't found an entry in the cache. |
protected boolean |
isNotFound(NSArray<EOGlobalID> gids)
|
NSArray<T> |
objectsForKey(EOEditingContext ec,
Object key)
Retrieves a list of EOs that matches the given key or null if no match is in the cache. |
protected void |
registerForNotifications()
|
void |
reset()
Resets the cache by clearing the internal map. |
protected void |
setCachedArrayForKey(NSArray<EOGlobalID> gids,
Object key)
|
void |
setObjectsForKey(NSArray<? extends EOEnterpriseObject> bugs,
Object key)
Add a list of objects to the cache with the given key. |
protected long |
timeout()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final NSArray NOT_FOUND_MARKER
| Constructor Detail |
|---|
public ERXEnterpriseObjectArrayCache(String entityName)
entityName - public ERXEnterpriseObjectArrayCache(Class c)
public ERXEnterpriseObjectArrayCache(String entityName,
long timeout)
entityName - timeout - | Method Detail |
|---|
protected static String entityNameForClass(Class c)
protected void registerForNotifications()
public void editingContextDidSaveChanges(NSNotification n)
n - public void clearCaches(NSNotification n)
n - protected String entityName()
public void setObjectsForKey(NSArray<? extends EOEnterpriseObject> bugs,
Object key)
bugs - array of objects
protected void setCachedArrayForKey(NSArray<EOGlobalID> gids,
Object key)
protected NSArray<EOGlobalID> cachedArrayForKey(Object key)
public NSArray<T> objectsForKey(EOEditingContext ec,
Object key)
ec - editing context to get the objects intokey - key value under which the objects are registeredprotected boolean isNotFound(NSArray<EOGlobalID> gids)
protected void handleUnsuccessfullQueryForKey(Object key)
setObjectsForKey(NSArray, Object) on it.
key - public void reset()
protected long timeout()
protected long fetchTime()
|
Last updated: Fri, Jan 9, 2009 04:35 AM EST | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||