src/share/classes/javax/sql/rowset/serial/SerialJavaObject.java

Print this page




  30 import java.util.Arrays;
  31 import java.util.Vector;
  32 import javax.sql.rowset.RowSetWarning;
  33 import sun.reflect.CallerSensitive;
  34 import sun.reflect.Reflection;
  35 import sun.reflect.misc.ReflectUtil;
  36 
  37 /**
  38  * A serializable mapping in the Java programming language of an SQL
  39  * <code>JAVA_OBJECT</code> value. Assuming the Java object
  40  * implements the <code>Serializable</code> interface, this class simply wraps the
  41  * serialization process.
  42  * <P>
  43  * If however, the serialization is not possible because
  44  * the Java object is not immediately serializable, this class will
  45  * attempt to serialize all non-static members to permit the object
  46  * state to be serialized.
  47  * Static or transient fields cannot be serialized; an attempt to serialize
  48  * them will result in a <code>SerialException</code> object being thrown.
  49  *
  50  * <h4> Thread safety </h4>
  51  *
  52  * A SerialJavaObject is not safe for use by multiple concurrent threads.  If a
  53  * SerialJavaObject is to be used by more than one thread then access to the
  54  * SerialJavaObject should be controlled by appropriate synchronization.
  55  *
  56  * @author Jonathan Bruce
  57  */
  58 public class SerialJavaObject implements Serializable, Cloneable {
  59 
  60     /**
  61      * Placeholder for object to be serialized.
  62      */
  63     private Object obj;
  64 
  65 
  66    /**
  67     * Placeholder for all fields in the <code>JavaObject</code> being serialized.
  68     */
  69     private transient Field[] fields;
  70 




  30 import java.util.Arrays;
  31 import java.util.Vector;
  32 import javax.sql.rowset.RowSetWarning;
  33 import sun.reflect.CallerSensitive;
  34 import sun.reflect.Reflection;
  35 import sun.reflect.misc.ReflectUtil;
  36 
  37 /**
  38  * A serializable mapping in the Java programming language of an SQL
  39  * <code>JAVA_OBJECT</code> value. Assuming the Java object
  40  * implements the <code>Serializable</code> interface, this class simply wraps the
  41  * serialization process.
  42  * <P>
  43  * If however, the serialization is not possible because
  44  * the Java object is not immediately serializable, this class will
  45  * attempt to serialize all non-static members to permit the object
  46  * state to be serialized.
  47  * Static or transient fields cannot be serialized; an attempt to serialize
  48  * them will result in a <code>SerialException</code> object being thrown.
  49  *
  50  * <h3> Thread safety </h3>
  51  *
  52  * A SerialJavaObject is not safe for use by multiple concurrent threads.  If a
  53  * SerialJavaObject is to be used by more than one thread then access to the
  54  * SerialJavaObject should be controlled by appropriate synchronization.
  55  *
  56  * @author Jonathan Bruce
  57  */
  58 public class SerialJavaObject implements Serializable, Cloneable {
  59 
  60     /**
  61      * Placeholder for object to be serialized.
  62      */
  63     private Object obj;
  64 
  65 
  66    /**
  67     * Placeholder for all fields in the <code>JavaObject</code> being serialized.
  68     */
  69     private transient Field[] fields;
  70