Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/java.sql.rowset/share/classes/com/sun/rowset/internal/BaseRow.java
40948 views
1
/*
2
* Copyright (c) 2003, 2013, 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
import java.util.Arrays;
31
32
/**
33
* The abstract base class from which the classes <code>Row</code>
34
* The class <code>BaseRow</code> stores
35
* a row's original values as an array of <code>Object</code>
36
* values, which can be retrieved with the method <code>getOrigRow</code>.
37
* This class also provides methods for getting and setting individual
38
* values in the row.
39
* <P>
40
* A row's original values are the values it contained before it was last
41
* modified. For example, when the <code>CachedRowSet</code>method
42
* <code>acceptChanges</code> is called, it will reset a row's original
43
* values to be the row's current values. Then, when the row is modified,
44
* the values that were previously the current values will become the row's
45
* original values (the values the row had immediately before it was modified).
46
* If a row has not been modified, its original values are its initial values.
47
* <P>
48
* Subclasses of this class contain more specific details, such as
49
* the conditions under which an exception is thrown or the bounds for
50
* index parameters.
51
*/
52
public abstract class BaseRow implements Serializable, Cloneable {
53
54
/**
55
* Specify the serialVersionUID
56
*/
57
private static final long serialVersionUID = 4152013523511412238L;
58
59
/**
60
* The array containing the original values for this <code>BaseRow</code>
61
* object.
62
* @serial
63
*/
64
protected Object[] origVals;
65
66
/**
67
* Retrieves the values that this row contained immediately
68
* prior to its last modification.
69
*
70
* @return an array of <code>Object</code> values containing this row's
71
* original values
72
*/
73
public Object[] getOrigRow() {
74
Object[] origRow = this.origVals;
75
return (origRow == null) ? null: Arrays.copyOf(origRow, origRow.length);
76
}
77
78
/**
79
* Retrieves the array element at the given index, which is
80
* the original value of column number <i>idx</i> in this row.
81
*
82
* @param idx the index of the element to return
83
* @return the <code>Object</code> value at the given index into this
84
* row's array of original values
85
* @throws SQLException if there is an error
86
*/
87
public abstract Object getColumnObject(int idx) throws SQLException;
88
89
/**
90
* Sets the element at the given index into this row's array of
91
* original values to the given value. Implementations of the classes
92
* <code>Row</code> and determine what happens
93
* when the cursor is on the insert row and when it is on any other row.
94
*
95
* @param idx the index of the element to be set
96
* @param obj the <code>Object</code> to which the element at index
97
* <code>idx</code> to be set
98
* @throws SQLException if there is an error
99
*/
100
public abstract void setColumnObject(int idx, Object obj) throws SQLException;
101
}
102
103