@Override public LRUMap<?, ?> read(Kryo kryo, Input input, Class<LRUMap<?, ?>> type) { final int maxCapacity = input.readInt(true); final LRUMap<Object, Object> result = new LRUMap<Object, Object>( maxCapacity ); final int size = input.readInt(true); for ( int i = 0; i < size; i++ ) { final Object key = _kryo.readClassAndObject(input); final Object value = _kryo.readClassAndObject(input); result.put(key, value); } return result; }
@Override public void write(Kryo kryo, Output output, LRUMap<?, ?> map) { output.writeInt(getMaxCapacity(map), true); output.writeInt(map.size(), true); for (final Entry<?, ?> entry : map.entrySet()) { _kryo.writeClassAndObject(output, entry.getKey()); _kryo.writeClassAndObject(output, entry.getValue()); } if ( TRACE ) trace( "kryo", "Wrote map: " + map ); }
/** * @see Map#remove(Object) */ public V remove(K key) { int hash = hash(key, null, null, null); return segmentFor(hash).remove(key, null, null, null, hash, null); }
/** * @see #containsKey(Object) */ public boolean containsKey(Object key1, Object key2) { int hash = hash(key1, key2, null, null); return segmentFor(hash).containsKey(key1, key2, null, null, hash); }
/** * <p>Obtain a <code>Class</code> instance based on the provided * String name.</p> * @param className the class to look up * @return the <code>Class</code> corresponding to <code>className</code> */ public static Class<?> lookupClass(String className) { ClassLoader loader = Util.getCurrentLoader(null); if (loader == null) { return null; } return getMetaData(loader, className).lookupClass(); }
/** * @param className the fully qualified class name * @param propertyName a JavaBeans property name * @return a method suitable for obtaining the value of a JavaBeans property, * or <code>null</code> if the property doesn't exist or can't be read. */ public static Method lookupReadMethod(String className, String propertyName) { ClassLoader loader = Util.getCurrentLoader(null); if (loader == null) { return null; } return getMetaData(loader, className).lookupReadMethod(propertyName); }
/** * @see #get(Object) */ public V get(Object key1, Object key2, Object key3) { int hash = hash(key1, key2, key3, null); return segmentFor(hash).get(key1, key2, key3, null, hash); }
@Override public boolean isFaceletCached(URL url) { com.sun.faces.util.Util.notNull("url", url); return _faceletCache.containsKey(url); }
/** * @see Map#remove(Object) */ public V remove(K key1, K key2, K key3, K key4) { // we don't have multiple versions of remove here because // erasure would cause a collision with boolean remove(Object, Object) int hash = hash(key1, key2, key3, key4); return segmentFor(hash).remove(key1, key2, key3, key4, hash, null); }
/** * @see #containsKey(Object) */ public boolean containsKey(Object key1, Object key2, Object key3) { int hash = hash(key1, key2, key3, null); return segmentFor(hash).containsKey(key1, key2, key3, null, hash); }
/** * @see #get(Object) */ public V get(Object key1, Object key2, Object key3) { int hash = hash(key1, key2, key3, null); return segmentFor(hash).get(key1, key2, key3, null, hash); }
@Override public boolean isViewMetadataFaceletCached(URL url) { com.sun.faces.util.Util.notNull("url", url); return _metadataFaceletCache.containsKey(url); }
/** * @see Map#remove(Object) */ public V remove(K key1, K key2) { int hash = hash(key1, key2, null, null); return segmentFor(hash).remove(key1, key2, null, null, hash, null); }
/** * @see #containsKey(Object) */ public boolean containsKey(Object key1, Object key2, Object key3, Object key4) { int hash = hash(key1, key2, key3, key4); return segmentFor(hash).containsKey(key1, key2, key3, key4, hash); }
/** * @see Map#remove(Object) */ public V remove(K key1, K key2, K key3) { int hash = hash(key1, key2, key3, null); return segmentFor(hash).remove(key1, key2, null, null, hash, null); }
/** * @see #containsKey(Object) */ public boolean containsKey(Object key1, Object key2, Object key3, Object key4) { int hash = hash(key1, key2, key3, key4); return segmentFor(hash).containsKey(key1, key2, key3, key4, hash); }
/** * @see Map#remove(Object) */ public V remove(K key) { int hash = hash(key, null, null, null); return segmentFor(hash).remove(key, null, null, null, hash, null); }
/** * @see #containsKey(Object) */ public boolean containsKey(Object key1, Object key2) { int hash = hash(key1, key2, null, null); return segmentFor(hash).containsKey(key1, key2, null, null, hash); }
/** * @see Map#remove(Object) */ public V remove(K key1, K key2, K key3) { int hash = hash(key1, key2, key3, null); return segmentFor(hash).remove(key1, key2, null, null, hash, null); }
/** * @see Map#remove(Object) */ public V remove(K key) { int hash = hash(key, null, null, null); return segmentFor(hash).remove(key, null, null, null, hash, null); }