public final class SerializableField extends Object
Constructor and Description |
---|
SerializableField(Class<?> type,
String name,
boolean unshared) |
Modifier and Type | Method and Description |
---|---|
boolean |
getBoolean(Object instance)
Get the boolean value of this field on the given object instance.
|
byte |
getByte(Object instance)
Get the byte value of this field on the given object instance.
|
char |
getChar(Object instance)
Get the char value of this field on the given object instance.
|
double |
getDouble(Object instance)
Get the double value of this field on the given object instance.
|
Field |
getField()
Deprecated.
As of Java 9, accessible fields are generally disallowed; use the
#setXXX(Object,value) methods instead. |
float |
getFloat(Object instance)
Get the float value of this field on the given object instance.
|
int |
getInt(Object instance)
Get the integer value of this field on the given object instance.
|
Kind |
getKind()
Get the kind of field.
|
long |
getLong(Object instance)
Get the long value of this field on the given object instance.
|
String |
getName()
Get the name of the field.
|
Object |
getObject(Object instance)
Get the object value of this field on the given object instance.
|
short |
getShort(Object instance)
Get the short value of this field on the given object instance.
|
Class<?> |
getType()
Get the field type.
|
boolean |
isAccessible()
Determine if this object may be used to get or set an object field value.
|
boolean |
isUnshared()
Determine whether this field is marked as "unshared".
|
void |
readFrom(Object instance,
ObjectInput input)
Read the field value from the stream.
|
void |
setBoolean(Object instance,
boolean value)
Set the boolean value of this field on the given object instance.
|
void |
setByte(Object instance,
byte value)
Set the byte value of this field on the given object instance.
|
void |
setChar(Object instance,
char value)
Set the char value of this field on the given object instance.
|
void |
setDouble(Object instance,
double value)
Set the double value of this field on the given object instance.
|
void |
setFloat(Object instance,
float value)
Set the float value of this field on the given object instance.
|
void |
setInt(Object instance,
int value)
Set the integer value of this field on the given object instance.
|
void |
setLong(Object instance,
long value)
Set the long value of this field on the given object instance.
|
void |
setObject(Object instance,
Object value)
Set the object value of this field on the given object instance.
|
void |
setShort(Object instance,
short value)
Set the short value of this field on the given object instance.
|
void |
writeTo(Object instance,
ObjectOutput output) |
@Deprecated public Field getField()
#setXXX(Object,value)
methods instead.Field
for this serializable field. The resultant field will be accessible.public boolean isAccessible()
true
if this object may be used to get or set an object field value, false
otherwisepublic String getName()
public boolean isUnshared()
true
if the field is unsharedpublic Kind getKind()
public Class<?> getType() throws ClassNotFoundException
ClassNotFoundException
public void setBoolean(Object instance, boolean value) throws ClassCastException, IllegalArgumentException
instance
- the object instance (must not be null
, must be of the correct type)value
- the value to setClassCastException
- if instance
or the field is not of the correct typeIllegalArgumentException
- if this instance has no reflection field set on itpublic void setChar(Object instance, char value) throws ClassCastException, IllegalArgumentException
instance
- the object instance (must not be null
, must be of the correct type)value
- the value to setClassCastException
- if instance
or the field is not of the correct typeIllegalArgumentException
- if this instance has no reflection field set on itpublic void setByte(Object instance, byte value) throws ClassCastException, IllegalArgumentException
instance
- the object instance (must not be null
, must be of the correct type)value
- the value to setClassCastException
- if instance
is not of the correct typeIllegalArgumentException
- if this instance has no reflection field set on itpublic void setShort(Object instance, short value) throws ClassCastException, IllegalArgumentException
instance
- the object instance (must not be null
, must be of the correct type)value
- the value to setClassCastException
- if instance
or the field is not of the correct typeIllegalArgumentException
- if this instance has no reflection field set on itpublic void setInt(Object instance, int value) throws ClassCastException, IllegalArgumentException
instance
- the object instance (must not be null
, must be of the correct type)value
- the value to setClassCastException
- if instance
or the field is not of the correct typeIllegalArgumentException
- if this instance has no reflection field set on itpublic void setLong(Object instance, long value) throws ClassCastException, IllegalArgumentException
instance
- the object instance (must not be null
, must be of the correct type)value
- the value to setClassCastException
- if instance
or the field is not of the correct typeIllegalArgumentException
- if this instance has no reflection field set on itpublic void setFloat(Object instance, float value) throws ClassCastException, IllegalArgumentException
instance
- the object instance (must not be null
, must be of the correct type)value
- the value to setClassCastException
- if instance
or the field is not of the correct typeIllegalArgumentException
- if this instance has no reflection field set on itpublic void setDouble(Object instance, double value) throws ClassCastException, IllegalArgumentException
instance
- the object instance (must not be null
, must be of the correct type)value
- the value to setClassCastException
- if instance
or the field is not of the correct typeIllegalArgumentException
- if this instance has no reflection field set on itpublic void setObject(Object instance, Object value) throws ClassCastException, IllegalArgumentException
instance
- the object instance (must not be null
, must be of the correct type)value
- the value to setClassCastException
- if instance
or the field is not of the correct typeIllegalArgumentException
- if this instance has no reflection field set on itpublic boolean getBoolean(Object instance) throws ClassCastException, IllegalArgumentException
instance
- the object instance (must not be null
, must be of the correct type)ClassCastException
- if the field is not of the correct typeIllegalArgumentException
- if this instance has no reflection field set on itpublic char getChar(Object instance) throws ClassCastException, IllegalArgumentException
instance
- the object instance (must not be null
, must be of the correct type)ClassCastException
- if the field is not of the correct typeIllegalArgumentException
- if this instance has no reflection field set on itpublic byte getByte(Object instance) throws ClassCastException, IllegalArgumentException
instance
- the object instance (must not be null
, must be of the correct type)ClassCastException
- if the field is not of the correct typeIllegalArgumentException
- if this instance has no reflection field set on itpublic short getShort(Object instance) throws ClassCastException, IllegalArgumentException
instance
- the object instance (must not be null
, must be of the correct type)ClassCastException
- if the field is not of the correct typeIllegalArgumentException
- if this instance has no reflection field set on itpublic int getInt(Object instance) throws ClassCastException, IllegalArgumentException
instance
- the object instance (must not be null
, must be of the correct type)ClassCastException
- if the field is not of the correct typeIllegalArgumentException
- if this instance has no reflection field set on itpublic long getLong(Object instance) throws ClassCastException, IllegalArgumentException
instance
- the object instance (must not be null
, must be of the correct type)ClassCastException
- if the field is not of the correct typeIllegalArgumentException
- if this instance has no reflection field set on itpublic float getFloat(Object instance) throws ClassCastException, IllegalArgumentException
instance
- the object instance (must not be null
, must be of the correct type)ClassCastException
- if the field is not of the correct typeIllegalArgumentException
- if this instance has no reflection field set on itpublic double getDouble(Object instance) throws ClassCastException, IllegalArgumentException
instance
- the object instance (must not be null
, must be of the correct type)ClassCastException
- if the field is not of the correct typeIllegalArgumentException
- if this instance has no reflection field set on itpublic Object getObject(Object instance) throws ClassCastException, IllegalArgumentException
instance
- the object instance (must not be null
, must be of the correct type)ClassCastException
- if the field is not of the correct typeIllegalArgumentException
- if this instance has no reflection field set on itpublic void readFrom(Object instance, ObjectInput input) throws IOException, ClassNotFoundException
instance
- the instanceinput
- the source streamIOException
- if an I/O error occursClassNotFoundException
- if a class could not be loadedpublic void writeTo(Object instance, ObjectOutput output) throws IOException
IOException
Copyright © 2021 JBoss by Red Hat. All rights reserved.