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 java.util.NoSuchElementException;
19:
20: import org.geotools.feature.Feature;
21: import org.geotools.feature.FeatureType;
22:
23: /**
24: * Represents an Empty, Typed, FeatureReader.
25: *
26: * @author Jody Garnett, Refractions Research
27: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/main/src/main/java/org/geotools/data/EmptyFeatureReader.java $
28: */
29: public class EmptyFeatureReader implements FeatureReader {
30: FeatureType featureType;
31:
32: /**
33: * An Empty FeatureReader of the provided <code>featureType</code>.
34: *
35: * @param featureType
36: */
37: public EmptyFeatureReader(FeatureType featureType) {
38: this .featureType = featureType;
39: }
40:
41: /**
42: * @see org.geotools.data.FeatureReader#getFeatureType()
43: */
44: public FeatureType getFeatureType() {
45: return featureType;
46: }
47:
48: /**
49: * Throws NoSuchElementException as this is an Empty FeatureReader.
50: *
51: * @return Does not return
52: *
53: * @throws NoSuchElementException
54: *
55: * @see org.geotools.data.FeatureReader#next()
56: */
57: public Feature next() throws NoSuchElementException {
58: throw new NoSuchElementException("FeatureReader is empty");
59: }
60:
61: /**
62: * There is no next Feature.
63: *
64: * @return <code>false</code>
65: *
66: * @see org.geotools.data.FeatureReader#hasNext()
67: */
68: public boolean hasNext() {
69: return false;
70: }
71:
72: /**
73: * Cleans up after Empty FeatureReader.
74: *
75: * @see org.geotools.data.FeatureReader#close()
76: */
77: public void close() {
78: featureType = null;
79: }
80: }
|