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 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.- Since:
- 1.5
- See Also:
- Serialized Form
Constructors
| Constructor | Description |
|---|---|
SerialJavaObject(Object obj) | Constructor for |
Methods
| Modifier and Type | Method | Description |
|---|---|---|
Object | clone() | Returns a clone of this |
boolean | equals(Object o) | Compares this SerialJavaObject to the specified object. |
Field[] | getFields() | Returns an array of |
Object | getObject() | Returns an |
int | hashCode() | Returns a hash code for this SerialJavaObject. |
Methods declared in class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait Constructors
SerialJavaObject
public SerialJavaObject(Object obj)
throws SerialException Constructor for SerialJavaObject helper class.
- Parameters:
-
obj- the JavaObjectto be serialized - Throws:
-
SerialException- if the object is found not to be serializable
Methods
getObject
public Object getObject()
throws SerialException Returns an Object that is a copy of this SerialJavaObject object.
- Returns:
- a copy of this
SerialJavaObjectobject as anObjectin the Java programming language - Throws:
-
SerialException- if the instance is corrupt
getFields
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:
- an array of
Fieldobjects - 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 is true if and only if the argument is not null and is a SerialJavaObject object that is identical to this object
- Overrides:
-
equalsin classObject - Parameters:
-
o- The object to compare thisSerialJavaObjectagainst - Returns:
-
trueif the given object represents aSerialJavaObjectequivalent to this SerialJavaObject,falseotherwise - See Also:
-
Object.hashCode(),HashMap
hashCode
public int 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
- Overrides:
-
hashCodein classObject - Returns:
- a hash code value for this object.
- See Also:
-
Object.equals(java.lang.Object),System.identityHashCode(java.lang.Object)
clone
public Object clone()
Returns a clone of this SerialJavaObject.
© 1993, 2020, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/11/docs/api/java.sql.rowset/javax/sql/rowset/serial/SerialJavaObject.html