APIdia Launch Partner
Top Description Fields Constructors Methods
javax.sql.rowset.serial

public Class SerialStruct

extends Object
implements Struct, Serializable, Cloneable
Class Inheritance
All Implemented Interfaces
java.lang.Cloneable, java.io.Serializable, java.sql.Struct
Imports
java.sql.*, javax.sql.*, java.io.*, java.math.*, java.util.Arrays, .Map, .Vector, javax.sql.rowset.*

A serialized mapping in the Java programming language of an SQL structured type. Each attribute that is not already serialized is mapped to a serialized form, and if an attribute is itself a structured type, each of its attributes that is not already serialized is mapped to a serialized form.

In addition, the structured type is custom mapped to a class in the Java programming language if there is such a mapping, as are its attributes, if appropriate.

The SerialStruct class provides a constructor for creating an instance from a Struct object, a method for retrieving the SQL type name of the SQL structured type in the database, and methods for retrieving its attribute values.

Thread safety

A SerialStruct is not safe for use by multiple concurrent threads. If a SerialStruct is to be used by more than one thread then access to the SerialStruct should be controlled by appropriate synchronization.
Since
1.5

Field Summary

Modifier and TypeField and Description
private Object[]
attribs

An array of Object instances in which each element is an attribute of the SQL structured type that this SerialStruct object represents.

pack-priv static final long
serialVersionUID

The identifier that assists in the serialization of this SerialStruct object.

private String
SQLTypeName

The SQL type name for the structured type that this SerialStruct object represents.

Constructor Summary

AccessConstructor and Description
public
SerialStruct(Struct
an instance of Struct
in
,
Map<String, Class<?>>
a java.util.Map object in which each entry consists of 1) a String object giving the fully qualified name of a UDT and 2) the Class object for the SQLData implementation that defines how the UDT is to be mapped
map
)

Constructs a SerialStruct object from the given Struct object, using the given java.util.Map object for custom mapping the SQL structured type or any of its attributes that are SQL structured types.

public
SerialStruct(SQLData
an instance of the SQLData class that defines the mapping of the SQL structured type to one or more objects in the Java programming language
in
,
Map<String, Class<?>>
a java.util.Map object in which each entry consists of 1) a String object giving the fully qualified name of a UDT and 2) the Class object for the SQLData implementation that defines how the UDT is to be mapped
map
)

Constructs a SerialStruct object from the given SQLData object, using the given type map to custom map it to a class in the Java programming language.

Method Summary

Modifier and TypeMethod and Description
public Object

Returns:

a clone of this SerialStruct
clone
()

Overrides java.lang.Object.clone.

Returns a clone of this SerialStruct.

public boolean

Returns:

true if the given object represents a SerialStruct equivalent to this SerialStruct, false otherwise
equals
(Object
The object to compare this SerialStruct against
obj
)

Overrides java.lang.Object.equals.

Compares this SerialStruct to the specified object.

public Object[]

Returns:

an array of Object values, with each element being an attribute of the SQL structured type that this SerialStruct object represents
getAttributes
()

Implements java.sql.Struct.getAttributes.

Retrieves an array of Object values containing the attributes of the SQL structured type that this SerialStruct object represents.

public Object[]

Returns:

an array of Object values, with each element being an attribute of the SQL structured type that this SerialStruct object represents
getAttributes
(Map<String, Class<?>>
a java.util.Map object in which each entry consists of 1) a String object giving the fully qualified name of a UDT and 2) the Class object for the SQLData implementation that defines how the UDT is to be mapped
map
)

Implements java.sql.Struct.getAttributes.

Retrieves the attributes for the SQL structured type that this SerialStruct represents as an array of Object values, using the given type map for custom mapping if appropriate.

public String

Returns:

a String object representing the SQL type name for the SQL structured type that this SerialStruct object represents
getSQLTypeName
()

Implements java.sql.Struct.getSQLTypeName.

Retrieves the SQL type name for this SerialStruct object.

public int

Returns:

a hash code value for this object.
hashCode
()

Overrides java.lang.Object.hashCode.

Returns a hash code for this SerialStruct.

private void
mapToSerial(Map<String, Class<?>>
a java.util.Map object in which each entry consists of 1) a String object giving the fully qualified name of a UDT and 2) the Class object for the SQLData implementation that defines how the UDT is to be mapped
map
)

Maps attributes of an SQL structured type that are not serialized to a serialized form, using the given type map for custom mapping when appropriate.

private void
readObject(ObjectInputStream
the ObjectInputStream to read from.
s
)

readObject is called to restore the state of the SerialStruct from a stream.

private void
writeObject(ObjectOutputStream
the ObjectOutputStream to write to.
s
)

writeObject is called to save the state of the SerialStruct to a stream.

Inherited from java.lang.Object:
finalizegetClassnotifynotifyAlltoStringwaitwaitwait

Field Detail

attribsback to summary
private Object[] attribs

An array of Object instances in which each element is an attribute of the SQL structured type that this SerialStruct object represents. The attributes are ordered according to their order in the definition of the SQL structured type.

Annotations
@SuppressWarnings:serial
serialVersionUIDback to summary
pack-priv static final long serialVersionUID

The identifier that assists in the serialization of this SerialStruct object.

SQLTypeNameback to summary
private String SQLTypeName

The SQL type name for the structured type that this SerialStruct object represents. This is the name used in the SQL definition of the SQL structured type.

Constructor Detail

SerialStructback to summary
public SerialStruct(Struct in, Map<String, Class<?>> map) throws SerialException

Constructs a SerialStruct object from the given Struct object, using the given java.util.Map object for custom mapping the SQL structured type or any of its attributes that are SQL structured types.

Parameters
in:Struct

an instance of Struct

map:Map<String, Class<?>>

a java.util.Map object in which each entry consists of 1) a String object giving the fully qualified name of a UDT and 2) the Class object for the SQLData implementation that defines how the UDT is to be mapped

Exceptions
SerialException:
if an error occurs
See Also
java.sql.Struct
SerialStructback to summary
public SerialStruct(SQLData in, Map<String, Class<?>> map) throws SerialException

Constructs a SerialStruct object from the given SQLData object, using the given type map to custom map it to a class in the Java programming language. The type map gives the SQL type and the class to which it is mapped. The SQLData object defines the class to which the SQL type will be mapped.

Parameters
in:SQLData

an instance of the SQLData class that defines the mapping of the SQL structured type to one or more objects in the Java programming language

map:Map<String, Class<?>>

a java.util.Map object in which each entry consists of 1) a String object giving the fully qualified name of a UDT and 2) the Class object for the SQLData implementation that defines how the UDT is to be mapped

Exceptions
SerialException:
if an error occurs

Method Detail

cloneback to summary
public Object clone()

Overrides java.lang.Object.clone.

Returns a clone of this SerialStruct. The copy will contain a reference to a clone of the underlying attribs array, not a reference to the original underlying attribs array of this SerialStruct object.

Returns:Object

a clone of this SerialStruct

equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Compares this SerialStruct to the specified object. The result is true if and only if the argument is not null and is a SerialStruct object whose attributes are identical to this object's attributes

Parameters
obj:Object

The object to compare this SerialStruct against

Returns:boolean

true if the given object represents a SerialStruct equivalent to this SerialStruct, false otherwise

getAttributesback to summary
public Object[] getAttributes() throws SerialException

Implements java.sql.Struct.getAttributes.

Retrieves an array of Object values containing the attributes of the SQL structured type that this SerialStruct object represents.

Returns:Object[]

an array of Object values, with each element being an attribute of the SQL structured type that this SerialStruct object represents

Exceptions
SerialException:
if an error occurs
getAttributesback to summary
public Object[] getAttributes(Map<String, Class<?>> map) throws SerialException

Implements java.sql.Struct.getAttributes.

Retrieves the attributes for the SQL structured type that this SerialStruct represents as an array of Object values, using the given type map for custom mapping if appropriate.

Parameters
map:Map<String, Class<?>>

a java.util.Map object in which each entry consists of 1) a String object giving the fully qualified name of a UDT and 2) the Class object for the SQLData implementation that defines how the UDT is to be mapped

Returns:Object[]

an array of Object values, with each element being an attribute of the SQL structured type that this SerialStruct object represents

Exceptions
SerialException:
if an error occurs
getSQLTypeNameback to summary
public String getSQLTypeName() throws SerialException

Implements java.sql.Struct.getSQLTypeName.

Retrieves the SQL type name for this SerialStruct object. This is the name used in the SQL definition of the structured type

Returns:String

a String object representing the SQL type name for the SQL structured type that this SerialStruct object represents

Exceptions
SerialException:
if an error occurs
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code for this SerialStruct. The hash code for a SerialStruct object is computed using the hash codes of the attributes of the SerialStruct object and its SQLTypeName

Returns:int

a hash code value for this object.

mapToSerialback to summary
private void mapToSerial(Map<String, Class<?>> map) throws SerialException

Maps attributes of an SQL structured type that are not serialized to a serialized form, using the given type map for custom mapping when appropriate. The following types in the Java programming language are mapped to their serialized forms: Struct, SQLData, Ref, Blob, Clob, and Array.

This method is called internally and is not used by an application programmer.

Parameters
map:Map<String, Class<?>>

a java.util.Map object in which each entry consists of 1) a String object giving the fully qualified name of a UDT and 2) the Class object for the SQLData implementation that defines how the UDT is to be mapped

Exceptions
SerialException:
if an error occurs
readObjectback to summary
private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException

readObject is called to restore the state of the SerialStruct from a stream.

Parameters
s:ObjectInputStream

the ObjectInputStream to read from.

Exceptions
IOException:
if an I/O error occurs.
ClassNotFoundException:
if the class of a serialized object could not be found.
writeObjectback to summary
private void writeObject(ObjectOutputStream s) throws IOException

writeObject is called to save the state of the SerialStruct to a stream.

Parameters
s:ObjectOutputStream

the ObjectOutputStream to write to.

Exceptions
IOException:
if an I/O error occurs.