public class SerialJavaObject extends Objectimplements Serializable , Cloneable
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.
| Constructor and Description |
|---|
SerialJavaObject(Object
Constructor for
SerialJavaObject helper class.
|
| Modifier and Type | Method and Description |
|---|---|
Object |
clone()
Returns a clone of this
SerialJavaObject.
|
boolean |
equals(Object
Compares this SerialJavaObject to the specified object.
|
Field |
getFields()
Returns an array of
Field objects that contains each field of the object that this helper class is serializing.
|
Object |
getObject()
Returns an
Object that is a copy of this
SerialJavaObject object.
|
int |
hashCode()
Returns a hash code for this SerialJavaObject.
|
public SerialJavaObject(Objectobj) throws SerialException
SerialJavaObject helper class.
obj - the Java
Object to be serialized
SerialException - if the object is found not to be serializable
public ObjectgetObject() throws SerialException
Object that is a copy of this
SerialJavaObject object.
SerialJavaObject object as an
Object in the Java programming language
SerialException - if the instance is corrupt
public Field[] getFields() throws SerialException
Field objects that contains each field of the object that this helper class is serializing.
Field objects
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.
Class.getFields()
public boolean equals(Objecto)
true if and only if the argument is not
null and is a
SerialJavaObject object that is identical to this object
equals in class
Object
o - The object to compare this
SerialJavaObject against
true if the given object represents a
SerialJavaObject equivalent to this SerialJavaObject,
false otherwise
Object.hashCode() ,
HashMap
public int hashCode()
SerialJavaObject object is taken as the hash code of the
Object it stores
hashCode in class
Object
Object.equals(java.lang.Object) ,
System.identityHashCode(java.lang.Object)