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.jdbc.attributeio;
17:
18: import java.io.IOException;
19: import java.sql.PreparedStatement;
20: import java.sql.ResultSet;
21:
22: /**
23: * Attribute reader/writer. Classes implementing this interface know
24: * how to parse and encode Feature attributes into resultset fields
25: *
26: * @author wolf
27: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/jdbc/src/main/java/org/geotools/data/jdbc/attributeio/AttributeIO.java $
28: */
29: public interface AttributeIO {
30: /**
31: * Reads a feature attribute out of a ResultSet
32: *
33: * @param rs - the resultset to be read
34: * @param position - the position of the attribute in the resultset
35: *
36: * @return The parsed attribute
37: *
38: * @throws IOException - if some exception occurs while reading the attribute
39: */
40: public Object read(ResultSet rs, int position) throws IOException;
41:
42: /**
43: * Writes a feature attribute into a ResultSet
44: *
45: * @param rs - the result set to be modified
46: * @param position - the position in which the attribute will inserted into the result set
47: * @param value - the attribute that will be written into the resultset
48: *
49: * @throws IOException - if some exception occurs while writing the attribute
50: */
51: public void write(ResultSet rs, int position, Object value)
52: throws IOException;
53:
54: /**
55: * Writes a feature attribute into a PreparedStatement
56: *
57: * @param ps - the result set to be modified
58: * @param position - the position in which the attribute will inserted into the result set
59: * @param value - the attribute that will be written into the resultset
60: *
61: * @throws IOException - if some exception occurs while writing the attribute
62: */
63: public void write(PreparedStatement ps, int position, Object value)
64: throws IOException;
65: }
|