01: /*
02: * GeoTools - OpenSource mapping toolkit
03: * http://geotools.org
04: * (C) 2003-2006, GeoTools Project Managment Committee (PMC)
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation;
09: * version 2.1 of the License.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: */
16: package org.geotools.data;
17:
18: import org.geotools.feature.AttributeType;
19:
20: /**
21: * Provides support for creating AttributeReaders.
22: * @since 2.0
23: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/main/src/main/java/org/geotools/data/AbstractAttributeIO.java $
24: * @version $Id: AbstractAttributeIO.java 20651 2006-07-21 07:51:54Z jgarnett $
25: * @author Ian Schneider
26: */
27: public abstract class AbstractAttributeIO {
28:
29: protected AttributeType[] metaData;
30:
31: protected AbstractAttributeIO(AttributeType[] metaData) {
32: this .metaData = metaData;
33: }
34:
35: /**
36: * Copy the meta-data from this reader, but don't use the reader!!
37: */
38: protected AbstractAttributeIO(AttributeReader defs) {
39: this (copy(defs));
40: }
41:
42: public static AttributeType[] copy(AttributeReader defs) {
43: AttributeType[] d = new AttributeType[defs.getAttributeCount()];
44: for (int i = 0, ii = d.length; i < ii; i++) {
45: d[i] = defs.getAttributeType(i);
46: }
47: return d;
48: }
49:
50: public final int getAttributeCount() {
51: return metaData.length;
52: }
53:
54: public final AttributeType getAttributeType(int position) {
55: return metaData[position];
56: }
57:
58: }
|