01: /*
02:
03: This software is OSI Certified Open Source Software.
04: OSI Certified is a certification mark of the Open Source Initiative.
05:
06: The license (Mozilla version 1.0) can be read at the MMBase site.
07: See http://www.MMBase.org/license
08:
09: */
10:
11: package org.mmbase.bridge.implementation;
12:
13: import java.util.Collection;
14: import org.mmbase.bridge.*;
15:
16: /**
17: * A list of fields
18: *
19: * @author Pierre van Rooden
20: * @version $Id: BasicFieldList.java,v 1.23 2007/02/23 16:26:48 michiel Exp $
21: */
22: public class BasicFieldList extends BasicList<Field> implements
23: FieldList {
24:
25: NodeManager nodemanager = null;
26:
27: BasicFieldList() {
28: super ();
29: }
30:
31: public BasicFieldList(Collection c, NodeManager nodemanager) {
32: super (c);
33: this .nodemanager = nodemanager;
34: }
35:
36: @Override
37: protected Field convert(Object o) {
38: if (o instanceof BasicField) {
39: return (Field) o;
40: } else if (o instanceof Field) {
41: // core-field does not have a node-manager, fix that.
42: Field f = new BasicField((Field) o, nodemanager);
43: return f;
44: } else { // give it up
45: // perhaps we could anticipated DataType, String those kind of things too.
46: // but this is not used at the moment anyway.
47: // shoudl not happen!
48: return (Field) o;
49: }
50: }
51:
52: public Field getField(int index) {
53: return get(index);
54: }
55:
56: public FieldIterator fieldIterator() {
57: return new BasicFieldIterator();
58: }
59:
60: protected class BasicFieldIterator extends BasicIterator implements
61: FieldIterator {
62:
63: public Field nextField() {
64: return next();
65: }
66:
67: public Field previousField() {
68: return previous();
69: }
70:
71: }
72: }
|