/** * Get a set of the keys for all elements in the cache * <p> * @return A set of the key type */ public Set<K> getKeySet() { return getKeySet(false); }
/** * Get a set of the keys for all elements in the cache * <p> * @return A set of the key type */ public Set<K> getKeySet() { return getKeySet(false); }
/** * Gets the cache that was injected by the lateral factory. Calls getKeySet on the cache. * <p> * @param cacheName the name of the cache * @return a set of keys * @throws IOException */ public Set<K> handleGetKeySet( String cacheName ) throws IOException { return getCache( cacheName ).getKeySet(true); }
/** * Gets the set of group names in the cache * <p> * @return A Set of group names. */ public Set<String> getGroupNames() { HashSet<String> names = new HashSet<String>(); for (GroupAttrName<K> gan : this.getCacheControl().getKeySet()) { names.add(gan.groupId.groupName); } return names; }
/** * Gets the cache that was injected by the lateral factory. Calls getKeySet on the cache. * <p> * @param cacheName the name of the cache * @return a set of keys * @throws IOException */ public Set<K> handleGetKeySet( String cacheName ) throws IOException { return getCache( cacheName ).getKeySet(true); }
/** * Gets the set of group names in the cache * <p> * @return A Set of group names. */ public Set<String> getGroupNames() { HashSet<String> names = new HashSet<String>(); for (GroupAttrName<K> gan : this.getCacheControl().getKeySet()) { names.add(gan.groupId.groupName); } return names; }
/** * Gets the set of keys of objects currently in the cache. * <p> * @param cacheName * @return Set */ protected Set<K> processGetKeySet( String cacheName ) { CacheListeners<K, V> cacheDesc = null; try { cacheDesc = getCacheListeners( cacheName ); } catch ( Exception e ) { log.error( "Problem getting listeners.", e ); } if ( cacheDesc == null ) { return Collections.emptySet(); } CompositeCache<K, V> c = (CompositeCache<K, V>) cacheDesc.cache; return c.getKeySet(); }
/** * Gets the set of keys of objects currently in the cache. * <p> * @param cacheName * @return Set */ protected Set<K> processGetKeySet( String cacheName ) { CacheListeners<K, V> cacheDesc = null; try { cacheDesc = getCacheListeners( cacheName ); } catch ( Exception e ) { log.error( "Problem getting listeners.", e ); } if ( cacheDesc == null ) { return Collections.emptySet(); } CompositeCache<K, V> c = (CompositeCache<K, V>) cacheDesc.cache; return c.getKeySet(); }
/** * Gets the set of keys of objects currently in the cache. * <p> * @param cacheName * @return Set */ public Set<K> processGetKeySet( String cacheName ) { CompositeCache<K, V> cache = getCacheManager().getCache( cacheName ); return cache.getKeySet(); }
/** * Gets the set of keys of objects currently in the cache. * <p> * @param cacheName * @return Set */ public Set<K> processGetKeySet( String cacheName ) { CompositeCache<K, V> cache = getCacheManager().getCache( cacheName ); return cache.getKeySet(); }
@Override public void removeAll() { assertNotClosed(); for (final K k : delegate.getKeySet()) { remove(k); } }
@Override public Iterator<Entry<K, V>> iterator() { assertNotClosed(); final Iterator<K> keys = new HashSet<K>(delegate.getKeySet()).iterator(); return new Iterator<Entry<K, V>>() { private K lastKey = null; @Override public boolean hasNext() { return keys.hasNext(); } @Override public Entry<K, V> next() { lastKey = keys.next(); return new JCSEntry<K, V>(lastKey, get(lastKey)); } @Override public void remove() { if (isClosed() || lastKey == null) { throw new IllegalStateException(isClosed() ? "cache closed" : "call next() before remove()"); } JCSCache.this.remove(lastKey); } }; }
/** * Gets the set of keys of objects currently in the group. * <p> * @param group * @return A Set of keys. */ @Override public Set<K> getGroupKeys( String group ) { Set<K> groupKeys = new HashSet<K>(); GroupId groupId = new GroupId( this.getCacheControl().getCacheName(), group ); for (GroupAttrName<K> gan : this.getCacheControl().getKeySet()) { if (gan.groupId.equals( groupId )) { groupKeys.add( gan.attrName ); } } return groupKeys; }
/** * Gets the set of keys of objects currently in the group. * <p> * @param group * @return A Set of keys. */ @Override public Set<K> getGroupKeys( String group ) { Set<K> groupKeys = new HashSet<K>(); GroupId groupId = new GroupId( this.getCacheControl().getCacheName(), group ); for (GroupAttrName<K> gan : this.getCacheControl().getKeySet()) { if (gan.groupId.equals( groupId )) { groupKeys.add( gan.attrName ); } } return groupKeys; }