01: package org.apache.ojb.broker.accesslayer;
02:
03: /* Copyright 2002-2005 The Apache Software Foundation
04: *
05: * Licensed under the Apache License, Version 2.0 (the "License");
06: * you may not use this file except in compliance with the License.
07: * You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17:
18: import org.apache.ojb.broker.metadata.ClassDescriptor;
19:
20: import java.io.Serializable;
21: import java.sql.ResultSet;
22: import java.util.Map;
23:
24: /**
25: * @version $Id: RowReader.java,v 1.9.2.2 2005/12/21 22:22:58 tomdz Exp $
26: */
27: public interface RowReader extends Serializable {
28: static final long serialVersionUID = -1283322922537162249L;
29:
30: /**
31: * materialize a single object from the values of the Map row.
32: * the implementor of this class must not care for materializing
33: * references or collection attributes, this is done later!
34: * @param row the Map containing the new values
35: * @return a properly created instance.
36: */
37: public Object readObjectFrom(Map row);
38:
39: /**
40: * refresh an existing instance from the values of the Map row.
41: * @param instance the instance to refresh
42: * @param row the Map containing the new values
43: */
44: public void refreshObject(Object instance, Map row);
45:
46: /**
47: * Read all fields from the current ResultRow into the Object[] row.#
48: * ConversionStrategies are applied here!
49: */
50: public void readObjectArrayFrom(ResultSetAndStatement rs, Map row);
51:
52: /**
53: * Read primary key fields from the current ResultRow into the Object[] row.#
54: * ConversionStrategies are applied here!
55: */
56: public void readPkValuesFrom(ResultSetAndStatement rs, Map row);
57:
58: /**
59: * Set the descriptor this <i>RowReader</i> worked with.
60: */
61: public void setClassDescriptor(ClassDescriptor cld);
62:
63: /**
64: * Returns the associated {@link org.apache.ojb.broker.metadata.ClassDescriptor}
65: */
66: public ClassDescriptor getClassDescriptor();
67: }
|