39 * 40 * <h2> Thread safety </h2> 41 * 42 * A SerialRef is not safe for use by multiple concurrent threads. If a 43 * SerialRef is to be used by more than one thread then access to the SerialRef 44 * should be controlled by appropriate synchronization. 45 * 46 * @since 1.5 47 */ 48 public class SerialRef implements Ref, Serializable, Cloneable { 49 50 /** 51 * String containing the base type name. 52 * @serial 53 */ 54 private String baseTypeName; 55 56 /** 57 * This will store the type <code>Ref</code> as an <code>Object</code>. 58 */ 59 private Object object; 60 61 /** 62 * Private copy of the Ref reference. 63 */ 64 private Ref reference; 65 66 /** 67 * Constructs a <code>SerialRef</code> object from the given <code>Ref</code> 68 * object. 69 * 70 * @param ref a Ref object; cannot be <code>null</code> 71 * @throws SQLException if a database access occurs; if <code>ref</code> 72 * is <code>null</code>; or if the <code>Ref</code> object returns a 73 * <code>null</code> value base type name. 74 * @throws SerialException if an error occurs serializing the <code>Ref</code> 75 * object 76 */ 77 public SerialRef(Ref ref) throws SerialException, SQLException { 78 if (ref == null) { 79 throw new SQLException("Cannot instantiate a SerialRef object " + 80 "with a null Ref object"); 81 } 82 reference = ref; 83 object = ref; | 39 * 40 * <h2> Thread safety </h2> 41 * 42 * A SerialRef is not safe for use by multiple concurrent threads. If a 43 * SerialRef is to be used by more than one thread then access to the SerialRef 44 * should be controlled by appropriate synchronization. 45 * 46 * @since 1.5 47 */ 48 public class SerialRef implements Ref, Serializable, Cloneable { 49 50 /** 51 * String containing the base type name. 52 * @serial 53 */ 54 private String baseTypeName; 55 56 /** 57 * This will store the type <code>Ref</code> as an <code>Object</code>. 58 */ 59 @SuppressWarnings("serial") // Not statically typed as Serializable 60 private Object object; 61 62 /** 63 * Private copy of the Ref reference. 64 */ 65 @SuppressWarnings("serial") // Not statically typed as Serializable; checked in writeObject 66 private Ref reference; 67 68 /** 69 * Constructs a <code>SerialRef</code> object from the given <code>Ref</code> 70 * object. 71 * 72 * @param ref a Ref object; cannot be <code>null</code> 73 * @throws SQLException if a database access occurs; if <code>ref</code> 74 * is <code>null</code>; or if the <code>Ref</code> object returns a 75 * <code>null</code> value base type name. 76 * @throws SerialException if an error occurs serializing the <code>Ref</code> 77 * object 78 */ 79 public SerialRef(Ref ref) throws SerialException, SQLException { 80 if (ref == null) { 81 throw new SQLException("Cannot instantiate a SerialRef object " + 82 "with a null Ref object"); 83 } 84 reference = ref; 85 object = ref; |