Showing the changes to java/pkg/com/sun/rowset/internal/BaseRow.java (1 of 18352 files). Show all
Unified · Split
| @@ -0,0 +1,94 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. | ||
| 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
| 4 | * | ||
| 5 | * This code is free software; you can redistribute it and/or modify it | ||
| 6 | * under the terms of the GNU General Public License version 2 only, as | ||
| 7 | * published by the Free Software Foundation. Oracle designates this | ||
| 8 | * particular file as subject to the "Classpath" exception as provided | ||
| 9 | * by Oracle in the LICENSE file that accompanied this code. | ||
| 10 | * | ||
| 11 | * This code is distributed in the hope that it will be useful, but WITHOUT | ||
| 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
| 14 | * version 2 for more details (a copy is included in the LICENSE file that | ||
| 15 | * accompanied this code). | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License version | ||
| 18 | * 2 along with this work; if not, write to the Free Software Foundation, | ||
| 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 20 | * | ||
| 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
| 22 | * or visit www.oracle.com if you need additional information or have any | ||
| 23 | * questions. | ||
| 24 | */ | ||
| 25 | |||
| 26 | package com.sun.rowset.internal; | ||
| 27 | |||
| 28 | import java.sql.*; | ||
| 29 | import java.io.*; | ||
| 30 | |||
| 31 | /** | ||
| 32 | * The abstract base class from which the classes <code>Row</code> | ||
| 33 | * The class <code>BaseRow</code> stores | ||
| 34 | * a row's original values as an array of <code>Object</code> | ||
| 35 | * values, which can be retrieved with the method <code>getOrigRow</code>. | ||
| 36 | * This class also provides methods for getting and setting individual | ||
| 37 | * values in the row. | ||
| 38 | * <P> | ||
| 39 | * A row's original values are the values it contained before it was last | ||
| 40 | * modified. For example, when the <code>CachedRowSet</code>method | ||
| 41 | * <code>acceptChanges</code> is called, it will reset a row's original | ||
| 42 | * values to be the row's current values. Then, when the row is modified, | ||
| 43 | * the values that were previously the current values will become the row's | ||
| 44 | * original values (the values the row had immediately before it was modified). | ||
| 45 | * If a row has not been modified, its original values are its initial values. | ||
| 46 | * <P> | ||
| 47 | * Subclasses of this class contain more specific details, such as | ||
| 48 | * the conditions under which an exception is thrown or the bounds for | ||
| 49 | * index parameters. | ||
| 50 | */ | ||
| 51 | public abstract class BaseRow implements Serializable, Cloneable { | ||
| 52 | |||
| 53 | /** | ||
| 54 | * The array containing the original values for this <code>BaseRow</code> | ||
| 55 | * object. | ||
| 56 | * @serial | ||
| 57 | */ | ||
| 58 | protected Object[] origVals; | ||
| 59 | |||
| 60 | /** | ||
| 61 | * Retrieves the values that this row contained immediately | ||
| 62 | * prior to its last modification. | ||
| 63 | * | ||
| 64 | * @return an array of <code>Object</code> values containing this row's | ||
| 65 | * original values | ||
| 66 | */ | ||
| 67 | public Object[] getOrigRow() { | ||
| 68 | return origVals; | ||
| 69 | } | ||
| 70 | |||
| 71 | /** | ||
| 72 | * Retrieves the array element at the given index, which is | ||
| 73 | * the original value of column number <i>idx</i> in this row. | ||
| 74 | * | ||
| 75 | * @param idx the index of the element to return | ||
| 76 | * @return the <code>Object</code> value at the given index into this | ||
| 77 | * row's array of original values | ||
| 78 | * @throws <code>SQLException</code> if there is an error | ||
| 79 | */ | ||
| 80 | public abstract Object getColumnObject(int idx) throws SQLException; | ||
| 81 | |||
| 82 | /** | ||
| 83 | * Sets the element at the given index into this row's array of | ||
| 84 | * original values to the given value. Implementations of the classes | ||
| 85 | * <code>Row</code> and determine what happens | ||
| 86 | * when the cursor is on the insert row and when it is on any other row. | ||
| 87 | * | ||
| 88 | * @param idx the index of the element to be set | ||
| 89 | * @param obj the <code>Object</code> to which the element at index | ||
| 90 | * <code>idx</code> to be set | ||
| 91 | * @throws <code>SQLException</code> if there is an error | ||
| 92 | */ | ||
| 93 | public abstract void setColumnObject(int idx, Object obj) throws SQLException; | ||
| 94 | } | ||