/** * @see java.lang.Object#clone() * This will result in a database query if necessary. */ /* There are 3 situations when #clone() is called: 1. The developer actually wants to clone the collection (typically to modify one of the 2 resulting collections). In which case the contents must be read from the database. 2. A UnitOfWork needs a clone (or backup clone) of the collection. But the UnitOfWork checks "instantiation" before cloning collections (i.e. "un-instantiated" collections are not cloned). 3. A MergeManager needs an extra copy of the collection (because the "backup" and "target" are the same object?). But the MergeManager also checks "instantiation" before merging collections (again, "un-instantiated" collections are not merged). */ public Object clone() { try { IndirectSet result = (IndirectSet)super.clone(); result.delegate = this.cloneDelegate(); result.attributeName = null; result.changeListener = null; return result; } catch (CloneNotSupportedException e) { throw new InternalError("clone not supported"); } }
/** * @see java.lang.Object#clone() * This will result in a database query if necessary. */ /* There are 3 situations when #clone() is called: 1. The developer actually wants to clone the collection (typically to modify one of the 2 resulting collections). In which case the contents must be read from the database. 2. A UnitOfWork needs a clone (or backup clone) of the collection. But the UnitOfWork checks "instantiation" before cloning collections (i.e. "un-instantiated" collections are not cloned). 3. A MergeManager needs an extra copy of the collection (because the "backup" and "target" are the same object?). But the MergeManager also checks "instantiation" before merging collections (again, "un-instantiated" collections are not merged). */ @Override public Object clone() { try { IndirectSet<E> result = (IndirectSet<E>)super.clone(); result.delegate = this.cloneDelegate(); result.valueHolder = new ValueHolder(result.delegate); result.attributeName = null; result.changeListener = null; return result; } catch (CloneNotSupportedException e) { throw new InternalError("clone not supported"); } }
/** * @see java.lang.Object#clone() * This will result in a database query if necessary. */ /* There are 3 situations when #clone() is called: 1. The developer actually wants to clone the collection (typically to modify one of the 2 resulting collections). In which case the contents must be read from the database. 2. A UnitOfWork needs a clone (or backup clone) of the collection. But the UnitOfWork checks "instantiation" before cloning collections (i.e. "un-instantiated" collections are not cloned). 3. A MergeManager needs an extra copy of the collection (because the "backup" and "target" are the same object?). But the MergeManager also checks "instantiation" before merging collections (again, "un-instantiated" collections are not merged). */ @Override public Object clone() { try { IndirectSet<E> result = (IndirectSet<E>)super.clone(); result.delegate = this.cloneDelegate(); result.valueHolder = new ValueHolder(result.delegate); result.attributeName = null; result.changeListener = null; return result; } catch (CloneNotSupportedException e) { throw new InternalError("clone not supported"); } }