public ObjectStreamField(String name,
Class<?> type)
Create a Serializable field with the specified type. This field should
be documented with a serialField tag.
Parameters:
name - the name of the serializable field
type - the Class object of the serializable field
ObjectStreamField
public ObjectStreamField(String name,
Class<?> type,
boolean unshared)
Creates an ObjectStreamField representing a serializable field with the
given name and type. If unshared is false, values of the represented
field are serialized and deserialized in the default manner--if the
field is non-primitive, object values are serialized and deserialized as
if they had been written and read by calls to writeObject and
readObject. If unshared is true, values of the represented field are
serialized and deserialized as if they had been written and read by
calls to writeUnshared and readUnshared.
Parameters:
name - field name
type - field type
unshared - if false, write/read field values in the same manner
as writeObject/readObject; if true, write/read in the same
manner as writeUnshared/readUnshared
Get the type of the field. If the type is non-primitive and this
ObjectStreamField was obtained from a deserialized ObjectStreamClass instance, then Object.class is returned.
Otherwise, the Class object for the type of the field is
returned.
Returns:
a Class object representing the type of the
serializable field
getTypeCode
public char getTypeCode()
Returns character encoding of field type. The encoding is as follows:
B byte
C char
D double
F float
I int
J long
L class or interface
S short
Z boolean
[ array
Compare this field with another ObjectStreamField. Return
-1 if this is smaller, 0 if equal, 1 if greater. Types that are
primitives are "smaller" than object types. If equal, the field names
are compared.