java.lang.Object
org.jboss.marshalling.reflect.SerializableField
Reflection information about a field on a serializable class.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleangetBoolean(Object instance) Get the boolean value of this field on the given object instance.byteGet the byte value of this field on the given object instance.doubleGet the double value of this field on the given object instance.getField()Deprecated.floatGet the float value of this field on the given object instance.charGet the char value of this field on the given object instance.intGet the integer value of this field on the given object instance.getKind()Get the kind of field.longGet the long value of this field on the given object instance.getName()Get the name of the field.Get the object value of this field on the given object instance.intGetter for the record component index.Getter for the record component value.shortGet the short value of this field on the given object instance.Class<?>getType()Get the field type.booleanDetermine if this object may be used to get or set an object field value.booleanDetermine whether this field is marked as "unshared".voidreadFrom(Object instance, ObjectInput input) Read the field value from the stream.voidsetBoolean(Object instance, boolean value) Set the boolean value of this field on the given object instance.voidSet the byte value of this field on the given object instance.voidSet the double value of this field on the given object instance.voidSet the float value of this field on the given object instance.voidSet the char value of this field on the given object instance.voidSet the integer value of this field on the given object instance.voidSet the long value of this field on the given object instance.voidSet the object value of this field on the given object instance.voidSet the short value of this field on the given object instance.voidwriteTo(Object instance, ObjectOutput output)
-
Constructor Details
-
SerializableField
-
-
Method Details
-
getField
Deprecated.As of Java 9, accessible fields are generally disallowed; use the#setXXX(Object,value)methods instead.Get the reflectionFieldfor this serializable field. The resultant field will be accessible.- Returns:
- the reflection field
-
isAccessible
public boolean isAccessible()Determine if this object may be used to get or set an object field value.- Returns:
trueif this object may be used to get or set an object field value,falseotherwise
-
getName
Get the name of the field.- Returns:
- the name
-
getKind
Get the kind of field.- Returns:
- the kind
-
getType
Get the field type.- Returns:
- the field type
- Throws:
ClassNotFoundException
-
setBoolean
public void setBoolean(Object instance, boolean value) throws ClassCastException, IllegalArgumentException Set the boolean value of this field on the given object instance.- Parameters:
instance- the object instance (must not benull, must be of the correct type)value- the value to set- Throws:
ClassCastException- ifinstanceor the field is not of the correct typeIllegalArgumentException- if this instance has no reflection field set on it
-
setChar
public void setChar(Object instance, char value) throws ClassCastException, IllegalArgumentException Set the char value of this field on the given object instance.- Parameters:
instance- the object instance (must not benull, must be of the correct type)value- the value to set- Throws:
ClassCastException- ifinstanceor the field is not of the correct typeIllegalArgumentException- if this instance has no reflection field set on it
-
setByte
public void setByte(Object instance, byte value) throws ClassCastException, IllegalArgumentException Set the byte value of this field on the given object instance.- Parameters:
instance- the object instance (must not benull, must be of the correct type)value- the value to set- Throws:
ClassCastException- ifinstanceis not of the correct typeIllegalArgumentException- if this instance has no reflection field set on it
-
setShort
public void setShort(Object instance, short value) throws ClassCastException, IllegalArgumentException Set the short value of this field on the given object instance.- Parameters:
instance- the object instance (must not benull, must be of the correct type)value- the value to set- Throws:
ClassCastException- ifinstanceor the field is not of the correct typeIllegalArgumentException- if this instance has no reflection field set on it
-
setInt
Set the integer value of this field on the given object instance.- Parameters:
instance- the object instance (must not benull, must be of the correct type)value- the value to set- Throws:
ClassCastException- ifinstanceor the field is not of the correct typeIllegalArgumentException- if this instance has no reflection field set on it
-
setLong
public void setLong(Object instance, long value) throws ClassCastException, IllegalArgumentException Set the long value of this field on the given object instance.- Parameters:
instance- the object instance (must not benull, must be of the correct type)value- the value to set- Throws:
ClassCastException- ifinstanceor the field is not of the correct typeIllegalArgumentException- if this instance has no reflection field set on it
-
setFloat
public void setFloat(Object instance, float value) throws ClassCastException, IllegalArgumentException Set the float value of this field on the given object instance.- Parameters:
instance- the object instance (must not benull, must be of the correct type)value- the value to set- Throws:
ClassCastException- ifinstanceor the field is not of the correct typeIllegalArgumentException- if this instance has no reflection field set on it
-
setDouble
public void setDouble(Object instance, double value) throws ClassCastException, IllegalArgumentException Set the double value of this field on the given object instance.- Parameters:
instance- the object instance (must not benull, must be of the correct type)value- the value to set- Throws:
ClassCastException- ifinstanceor the field is not of the correct typeIllegalArgumentException- if this instance has no reflection field set on it
-
setObject
public void setObject(Object instance, Object value) throws ClassCastException, IllegalArgumentException Set the object value of this field on the given object instance.- Parameters:
instance- the object instance (must not benull, must be of the correct type)value- the value to set- Throws:
ClassCastException- ifinstanceor the field is not of the correct typeIllegalArgumentException- if this instance has no reflection field set on it
-
getBoolean
Get the boolean value of this field on the given object instance.- Parameters:
instance- the object instance (must not benull, must be of the correct type)- Returns:
- the value of the field
- Throws:
ClassCastException- if the field is not of the correct typeIllegalArgumentException- if this instance has no reflection field set on it
-
getChar
Get the char value of this field on the given object instance.- Parameters:
instance- the object instance (must not benull, must be of the correct type)- Returns:
- the value of the field
- Throws:
ClassCastException- if the field is not of the correct typeIllegalArgumentException- if this instance has no reflection field set on it
-
getByte
Get the byte value of this field on the given object instance.- Parameters:
instance- the object instance (must not benull, must be of the correct type)- Returns:
- the value of the field
- Throws:
ClassCastException- if the field is not of the correct typeIllegalArgumentException- if this instance has no reflection field set on it
-
getShort
Get the short value of this field on the given object instance.- Parameters:
instance- the object instance (must not benull, must be of the correct type)- Returns:
- the value of the field
- Throws:
ClassCastException- if the field is not of the correct typeIllegalArgumentException- if this instance has no reflection field set on it
-
getInt
Get the integer value of this field on the given object instance.- Parameters:
instance- the object instance (must not benull, must be of the correct type)- Returns:
- the value of the field
- Throws:
ClassCastException- if the field is not of the correct typeIllegalArgumentException- if this instance has no reflection field set on it
-
getLong
Get the long value of this field on the given object instance.- Parameters:
instance- the object instance (must not benull, must be of the correct type)- Returns:
- the value of the field
- Throws:
ClassCastException- if the field is not of the correct typeIllegalArgumentException- if this instance has no reflection field set on it
-
getFloat
Get the float value of this field on the given object instance.- Parameters:
instance- the object instance (must not benull, must be of the correct type)- Returns:
- the value of the field
- Throws:
ClassCastException- if the field is not of the correct typeIllegalArgumentException- if this instance has no reflection field set on it
-
getDouble
Get the double value of this field on the given object instance.- Parameters:
instance- the object instance (must not benull, must be of the correct type)- Returns:
- the value of the field
- Throws:
ClassCastException- if the field is not of the correct typeIllegalArgumentException- if this instance has no reflection field set on it
-
getObject
Get the object value of this field on the given object instance.- Parameters:
instance- the object instance (must not benull, must be of the correct type)- Returns:
- the value of the field
- Throws:
ClassCastException- if the field is not of the correct typeIllegalArgumentException- if this instance has no reflection field set on it
-
readFrom
Read the field value from the stream.- Parameters:
instance- the instanceinput- the source stream- Throws:
IOException- if an I/O error occursClassNotFoundException- if a class could not be loaded
-
writeTo
- Throws:
IOException
-
getRecordComponentValue
Getter for the record component value.- Parameters:
obj- The object to obtain the record component value- Returns:
- The record component value for this obj
-
getRecordComponentIndex
public int getRecordComponentIndex()Getter for the record component index.- Returns:
- The record component index or -1
-
#setXXX(Object,value)methods instead.