1 package org.bsf.smartValueObject.container; 2 3 import org.bsf.smartValueObject.container.AbstractSmartContainer; 4 import org.bsf.smartValueObject.Versionable; 5 6 import java.util.List ; 7 import java.util.Iterator ; 8 import java.util.Collection ; 9 import java.util.ListIterator ; 10 11 17 public class SmartList extends AbstractSmartContainer implements List { 18 19 private List list; 20 21 public SmartList(List list, Versionable v) { 22 super(v); 23 this.list = list; 24 } 25 26 protected boolean addToContainer(Object o) { 27 return list.add(o); 28 } 29 30 protected Object addToContainer(Object key, Object o) { 31 throw new UnsupportedOperationException (); 32 } 33 34 protected Object getFromContainer(Object key) { 35 throw new UnsupportedOperationException (); 36 } 37 38 protected boolean removeFromContainer(Object o) { 39 return list.remove(o); 40 } 41 42 protected Object removeKeyFromContainer(Object key) { 43 throw new UnsupportedOperationException (); 44 } 45 46 protected boolean containerContains(Object o) { 47 return list.contains(o); 48 } 49 50 protected boolean containerContainsKey(Object key) { 51 throw new UnsupportedOperationException (); 52 } 53 54 protected int containerSize() { 55 return list.size(); 56 } 57 58 protected Iterator containerIterator() { 59 return list.iterator(); 60 } 61 62 protected void containerClear() { 63 list.clear(); 64 } 65 66 protected Object [] toObjectArray() { 67 return list.toArray(); 68 } 69 70 public Object getContainer() { 71 return list; 72 } 73 74 public boolean remove(Object o) { 76 return removeObject(o); 77 } 78 79 public boolean containsAll(Collection c) { 80 return list.containsAll(c); 81 } 82 83 public boolean addAll(Collection c) { 84 return list.addAll(c); 85 } 86 87 public boolean addAll(int index, Collection c) { 88 return list.addAll(index, c); 89 } 90 91 public boolean removeAll(Collection c) { 92 return list.removeAll(c); 93 } 94 95 public boolean retainAll(Collection c) { 96 return list.retainAll(c); 97 } 98 99 public Object get(int index) { 100 return list.get(index); 101 } 102 103 public Object set(int index, Object element) { 104 return list.set(index, element); 105 } 106 107 public void add(int index, Object element) { 108 list.add(index, element); 109 } 110 111 public Object remove(int index) { 112 return list.remove(index); 113 } 114 115 public int indexOf(Object o) { 116 return list.indexOf(o); 117 } 118 119 public int lastIndexOf(Object o) { 120 return list.lastIndexOf(o); 121 } 122 123 public ListIterator listIterator() { 124 return list.listIterator(); 125 } 126 127 public ListIterator listIterator(int index) { 128 return list.listIterator(index); 129 } 130 131 public List subList(int fromIndex, int toIndex) { 132 return list.subList(fromIndex, toIndex); 133 } 134 } 135 | Popular Tags |