@SuppressWarnings("unchecked") @Override protected void updateFromSnapshot(ObjectInput in, PersistentCollectionSnapshot snapshot) { if (snapshot.isInitialized()) init(new ArrayList<E>((Collection<? extends E>)snapshot.getElementsAsCollection()), snapshot.getDetachedState(), snapshot.isDirty()); else init(null, snapshot.getDetachedState(), false); }
@SuppressWarnings("unchecked") @Override protected void updateFromSnapshot(ObjectInput in, PersistentCollectionSnapshot snapshot) { if (snapshot.isInitialized()) init(new HashMap<K, V>((Map<K, V>)snapshot.getElementsAsMap()), snapshot.getDetachedState(), snapshot.isDirty()); else init(null, snapshot.getDetachedState(), false); }
@SuppressWarnings("unchecked") public void decode(ExtendedObjectInput in, Object v) throws IOException, ClassNotFoundException, IllegalAccessException { PersistentCollection collection = (PersistentCollection)v; if (collection.wasInitialized()) { boolean sorted = (collection instanceof SortedSet || collection instanceof SortedMap); PersistentCollectionSnapshot snapshot = new JMFPersistentCollectionSnapshot(sorted, null); snapshot.readCoreData(in); if (collection instanceof Map) ((Map<Object, Object>)collection).putAll(snapshot.getElementsAsMap()); else ((Collection<Object>)collection).addAll(snapshot.getElementsAsCollection()); if (snapshot.isDirty()) collection.dirty(); else collection.clearDirty(); } } }
public PersistentSortedMap newInstance(ExtendedObjectInput in, String className) throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException, InvocationTargetException, SecurityException, NoSuchMethodException { PersistentCollectionSnapshot snapshot = new JMFPersistentCollectionSnapshot(true, null); snapshot.readInitializationData(in); if (!snapshot.isInitialized()) return new PersistentSortedMap(null); Comparator<? super Object> comparator = snapshot.newComparator(in); return new PersistentSortedMap(null, new TreeMap<Object, Object>(comparator)); } }
public PersistentSet newInstance(ExtendedObjectInput in, String className) throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException, InvocationTargetException, SecurityException, NoSuchMethodException { PersistentCollectionSnapshot snapshot = new JMFPersistentCollectionSnapshot(null); snapshot.readInitializationData(in); return (snapshot.isInitialized() ? new PersistentSet(null, new HashSet<Object>()) : new PersistentSet(null)); } }
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { PersistentCollectionSnapshot snapshot = createSnapshot(in, true); snapshot.readExternal(in); updateFromSnapshot(in, snapshot); }
public void writeExternal(ObjectOutput out) throws IOException { PersistentCollectionSnapshot snapshot = createSnapshot(out, false); snapshot.writeExternal(out); }
public PersistentSortedSet newInstance(ExtendedObjectInput in, String className) throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException, InvocationTargetException, SecurityException, NoSuchMethodException { PersistentCollectionSnapshot snapshot = new JMFPersistentCollectionSnapshot(true, null); snapshot.readInitializationData(in); if (!snapshot.isInitialized()) return new PersistentSortedSet(null); Comparator<? super Object> comparator = snapshot.newComparator(in); return new PersistentSortedSet(null, new TreeSet<Object>(comparator)); } }
public PersistentBag newInstance(ExtendedObjectInput in, String className) throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException, InvocationTargetException, SecurityException, NoSuchMethodException { PersistentCollectionSnapshot snapshot = new JMFPersistentCollectionSnapshot(null); snapshot.readInitializationData(in); return (snapshot.isInitialized() ? new PersistentBag(null, new ArrayList<Object>()) : new PersistentBag(null)); } }
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { PersistentCollectionSnapshot snapshot = createSnapshot(in, true); snapshot.readExternal(in); updateFromSnapshot(in, snapshot); }
public void writeExternal(ObjectOutput out) throws IOException { PersistentCollectionSnapshot snapshot = createSnapshot(out, false); snapshot.writeExternal(out); }
@SuppressWarnings("unchecked") @Override protected void updateFromSnapshot(ObjectInput in, PersistentCollectionSnapshot snapshot) { if (snapshot.isInitialized()) init(new ArrayList<E>((Collection<? extends E>)snapshot.getElementsAsCollection()), snapshot.getDetachedState(), snapshot.isDirty()); else init(null, snapshot.getDetachedState(), false); }
@SuppressWarnings("unchecked") @Override protected void updateFromSnapshot(ObjectInput in, PersistentCollectionSnapshot snapshot) { if (snapshot.isInitialized()) init(new HashMap<K, V>((Map<K, V>)snapshot.getElementsAsMap()), snapshot.getDetachedState(), snapshot.isDirty()); else init(null, snapshot.getDetachedState(), false); }
public PersistentList newInstance(ExtendedObjectInput in, String className) throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException, InvocationTargetException, SecurityException, NoSuchMethodException { PersistentCollectionSnapshot snapshot = new JMFPersistentCollectionSnapshot(null); snapshot.readInitializationData(in); return (snapshot.isInitialized() ? new PersistentList(null, new ArrayList<Object>()) : new PersistentList(null)); } }
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { PersistentCollectionSnapshot snapshot = createSnapshot(in, true); snapshot.readExternal(in); updateFromSnapshot(in, snapshot); }
public void writeExternal(ObjectOutput out) throws IOException { PersistentCollectionSnapshot snapshot = createSnapshot(out, false); snapshot.writeExternal(out); }
@SuppressWarnings("unchecked") @Override protected void updateFromSnapshot(ObjectInput in, PersistentCollectionSnapshot snapshot) { if (snapshot.isInitialized()) init(new HashSet<E>((Collection<? extends E>)snapshot.getElementsAsCollection()), snapshot.getDetachedState(), snapshot.isDirty()); else init(null, snapshot.getDetachedState(), false); }
@SuppressWarnings("unchecked") @Override protected void updateFromSnapshot(ObjectInput in, PersistentCollectionSnapshot snapshot) { if (snapshot.isInitialized()) init(new HashMap<K, V>((Map<K, V>)snapshot.getElementsAsMap()), snapshot.getDetachedState(), snapshot.isDirty()); else init(null, snapshot.getDetachedState(), false); }
public PersistentMap newInstance(ExtendedObjectInput in, String className) throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException, InvocationTargetException, SecurityException, NoSuchMethodException { PersistentCollectionSnapshot snapshot = new JMFPersistentCollectionSnapshot(null); snapshot.readInitializationData(in); return (snapshot.isInitialized() ? new PersistentMap(null, new HashMap<Object, Object>()) : new PersistentMap(null)); } }
@SuppressWarnings("unchecked") @Override protected void updateFromSnapshot(ObjectInput in, PersistentCollectionSnapshot snapshot) { if (snapshot.isInitialized()) init(new ArrayList<E>((Collection<? extends E>)snapshot.getElementsAsCollection()), snapshot.getDetachedState(), snapshot.isDirty()); else init(null, snapshot.getDetachedState(), false); }