Class SerialJavaObject
- java.lang.Object
-
- javax.sql.rowset.serial.SerialJavaObject
-
- All Implemented Interfaces:
- Serializable, Cloneable
public class SerialJavaObject extends Object implements Serializable, Cloneable
A serializable mapping in the Java programming language of an SQLJAVA_OBJECT
value. Assuming the Java object implements theSerializable
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.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description SerialJavaObject(Object obj)
Constructor forSerialJavaObject
helper class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description Object
clone()
Returns a clone of thisSerialJavaObject
.boolean
equals(Object o)
Compares this SerialJavaObject to the specified object.Field[]
getFields()
Returns an array ofField
objects that contains each field of the object that this helper class is serializing.Object
getObject()
Returns anObject
that is a copy of thisSerialJavaObject
object.int
hashCode()
Returns a hash code for this SerialJavaObject.
-
-
-
Constructor Detail
SerialJavaObject
public SerialJavaObject(Object obj) throws SerialException
Constructor forSerialJavaObject
helper class.- Parameters:
-
obj
- the JavaObject
to be serialized - Throws:
-
SerialException
- if the object is found not to be serializable
-
Method Detail
getObject
public Object getObject() throws SerialException
Returns anObject
that is a copy of thisSerialJavaObject
object.- Returns:
-
a copy of this
SerialJavaObject
object as anObject
in the Java programming language - Throws:
-
SerialException
- if the instance is corrupt
getFields
public Field[] getFields() throws SerialException
Returns an array ofField
objects that contains each field of the object that this helper class is serializing.- Returns:
-
an array of
Field
objects - Throws:
-
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 ofs.checkPackageAccess()
denies access to the package of that class. - See Also:
-
Class.getFields()
equals
public boolean equals(Object o)
Compares this SerialJavaObject to the specified object. The result istrue
if and only if the argument is notnull
and is aSerialJavaObject
object that is identical to this object- Overrides:
-
equals
in classObject
- Parameters:
-
o
- The object to compare thisSerialJavaObject
against - Returns:
-
true
if the given object represents aSerialJavaObject
equivalent to this SerialJavaObject,false
otherwise - See Also:
-
Object.hashCode()
,HashMap
hashCode
public int hashCode()
Returns a hash code for this SerialJavaObject. The hash code for aSerialJavaObject
object is taken as the hash code of theObject
it stores- Overrides:
-
hashCode
in classObject
- Returns:
- a hash code value for this object.
- See Also:
-
Object.equals(java.lang.Object)
,System.identityHashCode(java.lang.Object)
-
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2022, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.