java.io.ObjectStreamField
This class represents object fields that are saved to the stream, by
serialization. Classes can define the collection of fields to be dumped,
which can differ from the actual object's declared fields.
Summary
Public Constructors
Public Methods
Protected Methods
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
Details
Public Constructors
public
ObjectStreamField(String name, Class<?> cl)
Constructs an ObjectStreamField with the given name and the given type
Parameters
name
| a String, the name of the field |
cl
| A Class object representing the type of the field
|
public
ObjectStreamField(String name, Class<?> cl, boolean unshared)
Constructs an ObjectStreamField with the given name and the given type
Parameters
name
| a String, the name of the field |
cl
| A Class object representing the type of the field |
unshared
| write and read the field unshared
|
Public Methods
public
int
compareTo(Object o)
Comparing the receiver to the parameter, according to the Comparable
interface.
Parameters
o
| The object to compare against |
Returns
- -1 if the receiver is "smaller" than the parameter. 0 if the
receiver is "equal" to the parameter. 1 if the receiver is
"greater" than the parameter.
public
boolean
equals(Object arg0)
Compares the argument to the receiver, and returns true if they represent
the
same object using a class specific comparison. The
implementation in Object returns true only if the argument is the exact
same object as the receiver (==).
Parameters
arg0
| Object the object to compare with this object. |
Returns
- boolean
true
if the object is the same as this
object false
if it is different from this object.
public
String
getName()
Return the name of the field the receiver represents
Returns
- a String, the name of the field
public
int
getOffset()
Return the offset of this field in the object
public
Class<?>
getType()
Return the type of the field the receiver represents
Returns
- A Class object representing the type of the field
public
char
getTypeCode()
Return the type code that corresponds to the class the receiver
represents
Returns
- A char, the typecode of the class
public
String
getTypeString()
Return the type signature used by the VM to represent the type for this
field.
Returns
- A String, the signature for the class of this field.
public
int
hashCode()
Returns an integer hash code for the receiver. Any two objects which
answer
true
when passed to
.equals
must
answer the same value for this method.
public
boolean
isPrimitive()
Return a boolean indicating whether the class of this field is a
primitive type or not
Returns
- true if the type of this field is a primitive type false if the
type of this field is a regular class.
public
boolean
isUnshared()
Returns whether this serialized field is unshared.
Returns
- true if the field is unshared, false otherwise.
public
String
toString()
Returns a string containing a concise, human-readable description of the
receiver.
Returns
- a printable representation for the receiver.
Protected Methods
protected
void
setOffset(int newValue)
Set the offset this field represents in the object
Parameters
newValue
| an int, the offset
|