01: package org.ontoware.rdfreactor.runtime;
02:
03: import org.ontoware.aifbcommons.collection.ClosableIterator;
04: import org.ontoware.rdf2go.model.Model;
05: import org.ontoware.rdf2go.model.node.Node;
06:
07: public class ConvertingClosableIterator<T> implements
08: ClosableIterator<T> {
09:
10: private ClosableIterator<Node> it;
11: private Model model;
12: private Class<T> returnType;
13:
14: public ConvertingClosableIterator(ClosableIterator<Node> it,
15: Model model, Class<T> returnType) {
16: this .model = model;
17: this .it = it;
18: this .returnType = returnType;
19: }
20:
21: public void close() {
22: it.close();
23: }
24:
25: public boolean hasNext() {
26: return it.hasNext();
27: }
28:
29: @SuppressWarnings("unchecked")
30: public T next() {
31: Node node = it.next();
32: return (T) RDFReactorRuntime.node2javatype(model, node,
33: returnType);
34: }
35:
36: public void remove() {
37: it.remove();
38: }
39:
40: }
|