1 package org.bsf.smartValueObject.container; 2 3 import org.bsf.smartValueObject.Versionable; 4 import org.bsf.smartValueObject.Version; 5 6 import java.util.Iterator ; 7 import java.util.Collection ; 8 9 15 public class SmartCollection extends AbstractSmartContainer 16 implements Collection { 17 private Collection coll; 18 19 public SmartCollection(Collection c, Versionable v) { 20 super(v); 21 coll = c; 22 } 23 24 protected boolean addToContainer(Object o) { 25 return coll.add(o); 26 } 27 28 protected Object addToContainer(Object key, Object o) { 29 throw new UnsupportedOperationException (); 30 } 31 32 protected Object getFromContainer(Object key) { 33 throw new UnsupportedOperationException (); 34 } 35 36 protected boolean removeFromContainer(Object o) { 37 return coll.remove(o); 38 } 39 40 protected Object removeKeyFromContainer(Object key) { 41 throw new UnsupportedOperationException (); 42 } 43 44 protected boolean containerContains(Object o) { 45 return coll.contains(o); 46 } 47 48 protected boolean containerContainsKey(Object key) { 49 throw new UnsupportedOperationException (); 50 } 51 52 protected int containerSize() { 53 return coll.size(); 54 } 55 56 protected Iterator containerIterator() { 57 return coll.iterator(); 58 } 59 60 protected void containerClear() { 61 coll.clear(); 62 } 63 64 protected Object [] toObjectArray() { 65 return coll.toArray(); 66 } 67 68 public Object getContainer() { 69 return coll; 70 } 71 72 public boolean remove(Object o) { 73 return removeObject(o); 74 } 75 76 public boolean containsAll(Collection c) { 77 return false; 78 } 79 80 public boolean addAll(Collection c) { 81 return false; 82 } 83 84 public boolean removeAll(Collection c) { 85 return false; 86 } 87 88 public boolean retainAll(Collection c) { 89 return false; 90 } 91 } 92 | Popular Tags |