001    package org.apache.ojb.broker.accesslayer;
002    
003    /* Copyright 2002-2005 The Apache Software Foundation
004     *
005     * Licensed under the Apache License, Version 2.0 (the "License");
006     * you may not use this file except in compliance with the License.
007     * You may obtain a copy of the License at
008     *
009     *     http://www.apache.org/licenses/LICENSE-2.0
010     *
011     * Unless required by applicable law or agreed to in writing, software
012     * distributed under the License is distributed on an "AS IS" BASIS,
013     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014     * See the License for the specific language governing permissions and
015     * limitations under the License.
016     */
017    
018    import org.apache.ojb.broker.metadata.ClassDescriptor;
019    
020    import java.io.Serializable;
021    import java.sql.ResultSet;
022    import java.util.Map;
023    
024    /**
025     * @version $Id: RowReader.java,v 1.1 2007-08-24 22:17:30 ewestfal Exp $
026     */
027    public interface RowReader extends Serializable
028    {
029            static final long serialVersionUID = -1283322922537162249L;    /**
030         * materialize a single object from the values of the Map row.
031         * the implementor of this class must not care for materializing
032         * references or collection attributes, this is done later! 
033         * @param row the Map containing the new values
034         * @return a properly created instance.
035         */
036        public Object readObjectFrom(Map row);
037    
038        /**
039         * refresh an existing instance from the values of the Map row.
040         * @param instance the instance to refresh
041         * @param row the Map containing the new values
042         */
043        public void refreshObject(Object instance, Map row);
044    
045    
046            /**
047             * Read all fields from the current ResultRow into the Object[] row.#
048             * ConversionStrategies are applied here!
049             */
050            public void readObjectArrayFrom(ResultSetAndStatement rs, Map row);
051    
052            /**
053             * Read primary key fields from the current ResultRow into the Object[] row.#
054             * ConversionStrategies are applied here!
055             */
056            public void readPkValuesFrom(ResultSetAndStatement rs, Map row);
057    
058        /**
059         * Set the descriptor this <i>RowReader</i> worked with.
060         */
061        public void setClassDescriptor(ClassDescriptor cld);
062    
063        /**
064         * Returns the associated {@link org.apache.ojb.broker.metadata.ClassDescriptor}
065         */
066        public ClassDescriptor getClassDescriptor();
067    }