1 2 12 package com.versant.core.jdo.sco; 13 14 import com.versant.core.jdo.VersantStateManager; 15 16 import javax.jdo.spi.PersistenceCapable; 17 import java.util.Iterator ; 18 19 import com.versant.core.jdo.VersantStateManager; 20 21 24 public class SCOIterator implements Iterator { 25 26 private Iterator delegateIter; 27 private PersistenceCapable owner; 28 private VersantStateManager stateManager; 29 private int fieldNo; 30 31 public SCOIterator(Iterator delegateIter, VersantStateManager stateManager, PersistenceCapable owner, int fieldNo) { 32 this.delegateIter = delegateIter; 33 this.stateManager = stateManager; 34 this.owner = owner; 35 this.fieldNo = fieldNo; 36 } 37 38 public boolean hasNext() { 39 return delegateIter.hasNext(); 40 } 41 42 public Object next() { 43 return delegateIter.next(); 44 } 45 46 public void remove() { 47 delegateIter.remove(); 48 makeDirty(); 49 } 50 51 private void makeDirty() { 52 if (stateManager != null && owner != null) { 53 stateManager.makeDirty(owner, fieldNo); 54 } 55 } 56 } 57 | Popular Tags |