📄 persistentcollection.java
字号:
/** * Returns the collectionSnapshot. * @return CollectionSnapshot */ public CollectionSnapshot getCollectionSnapshot() { return collectionSnapshot; } /** * Sets the collectionSnapshot. * @param collectionSnapshot The collectionSnapshot to set */ public void setCollectionSnapshot(CollectionSnapshot collectionSnapshot) { this.collectionSnapshot = collectionSnapshot; } /** * Called before inserting rows, to ensure that any surrogate keys * are fully generated */ public void preInsert(CollectionPersister persister) throws HibernateException {} /** * Called after inserting a row, to fetch the natively generated id */ public void afterRowInsert(CollectionPersister persister, Object entry, int i) throws HibernateException {} /** * get all "orphaned" elements */ public abstract Collection getOrphans(Serializable snapshot) throws HibernateException; /** * Get the current session */ protected final SessionImplementor getSession() { return session; } final class IteratorProxy implements Iterator { private final Iterator iter; IteratorProxy(Iterator iter) { this.iter=iter; } public boolean hasNext() { return iter.hasNext(); } public Object next() { return iter.next(); } public void remove() { write(); iter.remove(); } } final class ListIteratorProxy implements ListIterator { private final ListIterator iter; ListIteratorProxy(ListIterator iter) { this.iter = iter; } public void add(Object o) { write(); iter.add(o); } public boolean hasNext() { return iter.hasNext(); } public boolean hasPrevious() { return iter.hasPrevious(); } public Object next() { return iter.next(); } public int nextIndex() { return iter.nextIndex(); } public Object previous() { return iter.previous(); } public int previousIndex() { return iter.previousIndex(); } public void remove() { write(); iter.remove(); } public void set(Object o) { write(); iter.set(o); } } class SetProxy implements java.util.Set { final Collection set; SetProxy(Collection set) { this.set=set; } public boolean add(Object arg0) { write(); return set.add(arg0); } public boolean addAll(Collection arg0) { write(); return set.addAll(arg0); } public void clear() { write(); set.clear(); } public boolean contains(Object arg0) { return set.contains(arg0); } public boolean containsAll(Collection arg0) { return set.containsAll(arg0); } public boolean isEmpty() { return set.isEmpty(); } public Iterator iterator() { return new IteratorProxy( set.iterator() ); } public boolean remove(Object arg0) { write(); return set.remove(arg0); } public boolean removeAll(Collection arg0) { write(); return set.removeAll(arg0); } public boolean retainAll(Collection arg0) { write(); return set.retainAll(arg0); } public int size() { return set.size(); } public Object[] toArray() { return set.toArray(); } public Object[] toArray(Object[] arg0) { return set.toArray(arg0); } } final class ListProxy implements java.util.List { private final java.util.List list; ListProxy(java.util.List list) { this.list = list; } public void add(int arg0, Object arg1) { write(); list.add(arg0, arg1); } /** * @see java.util.Collection#add(Object) */ public boolean add(Object arg0) { write(); return list.add(arg0); } /** * @see java.util.Collection#addAll(Collection) */ public boolean addAll(Collection arg0) { write(); return list.addAll(arg0); } /** * @see java.util.List#addAll(int, Collection) */ public boolean addAll(int arg0, Collection arg1) { write(); return list.addAll(arg0, arg1); } /** * @see java.util.Collection#clear() */ public void clear() { write(); list.clear(); } /** * @see java.util.Collection#contains(Object) */ public boolean contains(Object arg0) { return list.contains(arg0); } /** * @see java.util.Collection#containsAll(Collection) */ public boolean containsAll(Collection arg0) { return list.containsAll(arg0); } /** * @see java.util.List#get(int) */ public Object get(int arg0) { return list.get(arg0); } /** * @see java.util.List#indexOf(Object) */ public int indexOf(Object arg0) { return list.indexOf(arg0); } /** * @see java.util.Collection#isEmpty() */ public boolean isEmpty() { return list.isEmpty(); } /** * @see java.util.Collection#iterator() */ public Iterator iterator() { return new IteratorProxy( list.iterator() ); } /** * @see java.util.List#lastIndexOf(Object) */ public int lastIndexOf(Object arg0) { return list.lastIndexOf(arg0); } /** * @see java.util.List#listIterator() */ public ListIterator listIterator() { return new ListIteratorProxy( list.listIterator() ); } /** * @see java.util.List#listIterator(int) */ public ListIterator listIterator(int arg0) { return new ListIteratorProxy( list.listIterator(arg0) ); } /** * @see java.util.List#remove(int) */ public Object remove(int arg0) { write(); return list.remove(arg0); } /** * @see java.util.Collection#remove(Object) */ public boolean remove(Object arg0) { write(); return list.remove(arg0); } /** * @see java.util.Collection#removeAll(Collection) */ public boolean removeAll(Collection arg0) { write(); return list.removeAll(arg0); } /** * @see java.util.Collection#retainAll(Collection) */ public boolean retainAll(Collection arg0) { write(); return list.retainAll(arg0); } /** * @see java.util.List#set(int, Object) */ public Object set(int arg0, Object arg1) { write(); return list.set(arg0, arg1); } /** * @see java.util.Collection#size() */ public int size() { return list.size(); } /** * @see java.util.List#subList(int, int) */ public List subList(int arg0, int arg1) { return list.subList(arg0, arg1); } /** * @see java.util.Collection#toArray() */ public Object[] toArray() { return list.toArray(); } /** * @see java.util.Collection#toArray(Object[]) */ public Object[] toArray(Object[] arg0) { return list.toArray(arg0); } } static void identityRemoveAll(List list, Collection collection, SessionImplementor session) throws HibernateException { Iterator iter = collection.iterator(); while ( iter.hasNext() ) PersistentCollection.identityRemove( list, iter.next(), session ); } static void identityRemove(Collection list, Object object, SessionImplementor session) throws HibernateException { if ( object!=null && session.isSaved(object) ) { Serializable idOfCurrent = session.getEntityIdentifierIfNotUnsaved(object); Iterator iter = list.iterator(); while ( iter.hasNext() ) { Serializable idOfOld = session.getEntityIdentifierIfNotUnsaved( iter.next() ); if ( idOfCurrent.equals(idOfOld) ) { iter.remove(); break; } } } } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -