Top Description Fields Constructors Methods
javax.sql.rowset.serial

public Class SerialJavaObject

extends Object
implements Serializable, Cloneable
Class Inheritance
All Implemented Interfaces
java.lang.Cloneable, java.io.Serializable
Imports
java.io.*, java.lang.reflect.*, java.util.Arrays, .Vector, javax.sql.rowset.RowSetWarning, jdk.internal.reflect.CallerSensitive, .Reflection, sun.reflect.misc.ReflectUtil

A serializable mapping in the Java programming language of an SQL JAVA_OBJECT value. Assuming the Java object implements the Serializable interface, this class simply wraps the serialization process.

If however, the serialization is not possible because the Java object is not immediately serializable, this class will attempt to serialize all non-static members to permit the object state to be serialized. Static or transient fields cannot be serialized; an attempt to serialize them will result in a SerialException object being thrown.

Thread safety

A SerialJavaObject is not safe for use by multiple concurrent threads. If a SerialJavaObject is to be used by more than one thread then access to the SerialJavaObject should be controlled by appropriate synchronization.
Author
Jonathan Bruce
Since
1.5

Field Summary

Modifier and TypeField and Description
pack-priv Vector<RowSetWarning>
chain

A container for the warnings issued on this SerialJavaObject object.

private transient Field[]
fields

Placeholder for all fields in the JavaObject being serialized.

private Object
obj

Placeholder for object to be serialized.

pack-priv static final long
serialVersionUID

The identifier that assists in the serialization of this SerialJavaObject object.

Constructor Summary

AccessConstructor and Description
public
SerialJavaObject(Object
the Java Object to be serialized
obj
)

Constructor for SerialJavaObject helper class.

Method Summary

Modifier and TypeMethod and Description
public Object

Returns:

a clone of this SerialJavaObject
clone
()

Overrides java.lang.Object.clone.

Returns a clone of this SerialJavaObject.
public boolean

Returns:

true if the given object represents a SerialJavaObject equivalent to this SerialJavaObject, false otherwise
equals
(Object
The object to compare this SerialJavaObject against
o
)

Overrides java.lang.Object.equals.

Compares this SerialJavaObject to the specified object.
public Field[]

Returns:

an array of Field objects
getFields
()

Returns an array of Field objects that contains each field of the object that this helper class is serializing.

public Object

Returns:

a copy of this SerialJavaObject object as an Object in the Java programming language
getObject
()

Returns an Object that is a copy of this SerialJavaObject object.

public int

Returns:

a hash code value for this object.
hashCode
()

Overrides java.lang.Object.hashCode.

Returns a hash code for this SerialJavaObject.
private static boolean
private void
readObject(ObjectInputStream
the ObjectInputStream to read from.
s
)

readObject is called to restore the state of the SerialJavaObject from a stream.

private void
setWarning(RowSetWarning e)

Registers the given warning.

private void
writeObject(ObjectOutputStream
the ObjectOutputStream to write to.
s
)

writeObject is called to save the state of the SerialJavaObject to a stream.

Inherited from java.lang.Object:
finalizegetClassnotifynotifyAlltoStringwaitwaitwait

Field Detail

chainback to summary
pack-priv Vector<RowSetWarning> chain

A container for the warnings issued on this SerialJavaObject object. When there are multiple warnings, each warning is chained to the previous warning.

fieldsback to summary
private transient Field[] fields

Placeholder for all fields in the JavaObject being serialized.

objback to summary
private Object obj

Placeholder for object to be serialized.

Annotations
@SuppressWarnings:serial
serialVersionUIDback to summary
pack-priv static final long serialVersionUID

The identifier that assists in the serialization of this SerialJavaObject object.

Constructor Detail

SerialJavaObjectback to summary
public SerialJavaObject(Object obj) throws SerialException

Constructor for SerialJavaObject helper class.

Parameters
obj:Object

the Java Object to be serialized

Exceptions
SerialException:
if the object is found not to be serializable

Method Detail

cloneback to summary
public Object clone()

Overrides java.lang.Object.clone.

Returns a clone of this SerialJavaObject.

Returns:Object

a clone of this SerialJavaObject

equalsback to summary
public boolean equals(Object o)

Overrides java.lang.Object.equals.

Compares this SerialJavaObject to the specified object. The result is true if and only if the argument is not null and is a SerialJavaObject object that is identical to this object

Parameters
o:Object

The object to compare this SerialJavaObject against

Returns:boolean

true if the given object represents a SerialJavaObject equivalent to this SerialJavaObject, false otherwise

getFieldsback to summary
public Field[] getFields() throws SerialException

Returns an array of Field objects that contains each field of the object that this helper class is serializing.

Returns:Field[]

an array of Field objects

Annotations
@CallerSensitive
Exceptions
SerialException:
if an error is encountered accessing the serialized object
SecurityException:
If a security manager, s, is present and the caller's class loader is not the same as or an ancestor of the class loader for the class of the object being serialized and invocation of s.checkPackageAccess() denies access to the package of that class.
See Also
Class#getFields
getObjectback to summary
public Object getObject() throws SerialException

Returns an Object that is a copy of this SerialJavaObject object.

Returns:Object

a copy of this SerialJavaObject object as an Object in the Java programming language

Exceptions
SerialException:
if the instance is corrupt
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code for this SerialJavaObject. The hash code for a SerialJavaObject object is taken as the hash code of the Object it stores

Returns:int

a hash code value for this object.

hasStaticFieldsback to summary
private static boolean hasStaticFields(Field[] fields)
readObjectback to summary
private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException

readObject is called to restore the state of the SerialJavaObject from a stream.

Parameters
s:ObjectInputStream

the ObjectInputStream to read from.

Exceptions
IOException:
if an I/O error occurs.
ClassNotFoundException:
if the class of a serialized object could not be found.
setWarningback to summary
private void setWarning(RowSetWarning e)

Registers the given warning.

writeObjectback to summary
private void writeObject(ObjectOutputStream s) throws IOException

writeObject is called to save the state of the SerialJavaObject to a stream.

Parameters
s:ObjectOutputStream

the ObjectOutputStream to write to.

Exceptions
IOException:
if an I/O error occurs.