java.io
public class ObjectStreamField extends Object implements Comparable<Object>
Constructor and Description |
---|
ObjectStreamField(String name,
Class<?> type)
This constructor creates an ObjectStreamField instance
which represents a field named
name and is
of the type type . |
ObjectStreamField(String name,
Class<?> type,
boolean unshared)
This constructor creates an ObjectStreamField instance
which represents a field named
name and is
of the type type . |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Object obj)
Compares this object to the given object.
|
String |
getName()
This method returns the name of the field represented by the
ObjectStreamField instance.
|
int |
getOffset()
This method returns the current offset of the field in
the serialization stream relatively to the other fields.
|
Class<?> |
getType()
This method returns the class representing the type of the
field which is represented by this instance of ObjectStreamField.
|
char |
getTypeCode()
This method returns the char encoded type of the field which
is represented by this instance of ObjectStreamField.
|
String |
getTypeString()
This method returns a more explicit type name than
getTypeCode() in the case the type is a real
class (and not a primitive). |
boolean |
isPrimitive()
This method returns true if the type of the field
represented by this instance is a primitive.
|
boolean |
isUnshared()
This method returns whether the field represented by this object is
unshared or not.
|
protected void |
setOffset(int off)
This method sets the current offset of the field.
|
String |
toString()
Returns a string representing this object.
|
public ObjectStreamField(String name, Class<?> type)
name
and is
of the type type
.name
- Name of the field to export.type
- Type of the field in the concerned class.public ObjectStreamField(String name, Class<?> type, boolean unshared)
name
and is
of the type type
.name
- Name of the field to export.type
- Type of the field in the concerned class.unshared
- true if field will be unshared, false otherwise.public String getName()
public Class<?> getType()
public char getTypeCode()
public String getTypeString()
getTypeCode()
in the case the type is a real
class (and not a primitive).public int getOffset()
setOffset(int)
protected void setOffset(int off)
off
- The offset of the field in bytes.getOffset()
public boolean isUnshared()
public boolean isPrimitive()
public int compareTo(Object obj)
compareTo
in interface Comparable<Object>
obj
- the object to compare to.public String toString()
toString
in class Object
Object.getClass()
,
Object.hashCode()
,
Class.getName()
,
Integer.toHexString(int)