1 package org.exolab.castor.mapping.loader.collection.handler;
2
3 import java.util.Enumeration;
4 import java.util.Iterator;
5
6 import org.exolab.castor.mapping.CollectionHandler;
7 import org.exolab.castor.mapping.loader.CollectionHandlers;
8 import org.exolab.castor.mapping.loader.J2CollectionHandlers.IteratorEnumerator;
9
10 public final class IteratorCollectionHandler<T> implements CollectionHandler<T> {
11 public Object add(Object collection, T object) {
12
13
14 return null;
15 }
16
17 @SuppressWarnings("unchecked")
18 public Enumeration<T> elements(Object collection) {
19 if (collection == null) {
20 return new CollectionHandlers.EmptyEnumerator<T>();
21 }
22 return new IteratorEnumerator<T>((Iterator<T>) collection);
23 }
24
25 public int size(Object collection) {
26
27
28 return 0;
29 }
30
31 public Object clear(Object collection) {
32 return null;
33 }
34
35 public String toString() {
36 return "Iterator";
37 }
38 }