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.ListIterator ; 18 19 import com.versant.core.jdo.VersantStateManager; 20 21 26 public class SCOListIterator implements ListIterator { 27 28 private ListIterator delegateIter; 29 private PersistenceCapable owner; 30 private VersantStateManager stateManager; 31 private int fieldNo; 32 33 public SCOListIterator(ListIterator delegateIter, VersantStateManager stateManager, PersistenceCapable owner, int fieldNo) { 34 this.delegateIter = delegateIter; 35 this.stateManager = stateManager; 36 this.owner = owner; 37 this.fieldNo = fieldNo; 38 } 39 40 public boolean hasNext() { 41 return delegateIter.hasNext(); 42 } 43 44 public Object next() { 45 return delegateIter.next(); 46 } 47 48 public boolean hasPrevious() { 49 return delegateIter.hasPrevious(); 50 } 51 52 public Object previous() { 53 return delegateIter.previous(); 54 } 55 56 public int nextIndex() { 57 return delegateIter.nextIndex(); 58 } 59 60 public int previousIndex() { 61 return delegateIter.previousIndex(); 62 } 63 64 public void remove() { 65 delegateIter.remove(); 66 makeDirty(); 67 } 68 69 public void set(Object o) { 70 delegateIter.set(o); 71 makeDirty(); 72 } 73 74 public void add(Object o) { 75 delegateIter.add(o); 76 makeDirty(); 77 } 78 79 private void makeDirty() { 80 if (stateManager != null && owner != null) { 81 stateManager.makeDirty(owner, fieldNo); 82 } 83 } 84 } 85 86 87 | Popular Tags |