((LRU) ret).setMaxEntries(((LRU) object).getMaxEntries()); ILRUEntryCleaner cleaner = ((LRU) object).getCleaner(); if (cleaner != null)
/** * Decodes and adds sub-objects during decoding. * * @param object The instantiated object. * @param clazz The class of the object. * @param context The decoding context. * @return The finished object. */ public Object decodeSubObjects(Object object, Class<?> clazz, IDecodingContext context) { LRU ret = (LRU) object; int maxentries = (int) context.readVarInt(); ret.setMaxEntries(maxentries); ILRUEntryCleaner cleaner = (ILRUEntryCleaner) BinarySerializer.decodeObject(context); ret.setCleaner(cleaner); int size = (int) context.readVarInt(); for (int i = 0; i < size; ++i) { Object key = BinarySerializer.decodeObject(context); Object value = BinarySerializer.decodeObject(context); ret.put(key, value); } return ret; }
if(maxentries>0) ret.setMaxEntries(maxentries);