Top Description Inners Fields Constructors Methods
org.jboss.marshalling.reflect

public final Class SerializableField

extends Object
Class Inheritance
Static Imports
java.lang.System.getSecurityManager, java.security.AccessController.doPrivileged

Reflection information about a field on a serializable class.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
SerializableField.RecordComponent

A record component, which has a name, type and index.

Field Summary

Modifier and TypeField and Description
private final Field
private final long
private final Kind
private final String
private final int
private final Class<?>
pack-priv static final Unsafe
private final boolean

Constructor Summary

AccessConstructor and Description
public
SerializableField(Class<?> type, String name, boolean unshared)

pack-priv
SerializableField(Class<?> type, String name, boolean unshared, final Field field, SerializableField.RecordComponent recordComponent)

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

the value of the field
getBoolean
(Object
the object instance (must not be null, must be of the correct type)
instance
)

Get the boolean value of this field on the given object instance.

public byte

Returns:

the value of the field
getByte
(Object
the object instance (must not be null, must be of the correct type)
instance
)

Get the byte value of this field on the given object instance.

public char

Returns:

the value of the field
getChar
(Object
the object instance (must not be null, must be of the correct type)
instance
)

Get the char value of this field on the given object instance.

public double

Returns:

the value of the field
getDouble
(Object
the object instance (must not be null, must be of the correct type)
instance
)

Get the double value of this field on the given object instance.

public Field

Returns:

the reflection field
getField
()

Deprecated As of Java 9, accessible fields are generally disallowed; use the #setXXX(Object,value) methods instead.
Get the reflection Field for this serializable field.
public float

Returns:

the value of the field
getFloat
(Object
the object instance (must not be null, must be of the correct type)
instance
)

Get the float value of this field on the given object instance.

public int

Returns:

the value of the field
getInt
(Object
the object instance (must not be null, must be of the correct type)
instance
)

Get the integer value of this field on the given object instance.

public Kind

Returns:

the kind
getKind
()

Get the kind of field.

public long

Returns:

the value of the field
getLong
(Object
the object instance (must not be null, must be of the correct type)
instance
)

Get the long value of this field on the given object instance.

public String

Returns:

the name
getName
()

Get the name of the field.

public Object

Returns:

the value of the field
getObject
(Object
the object instance (must not be null, must be of the correct type)
instance
)

Get the object value of this field on the given object instance.

public int

Returns:

The record component index or -1
getRecordComponentIndex
()

Getter for the record component index.

public Object

Returns:

The record component value for this obj
getRecordComponentValue
(Object
The object to obtain the record component value
obj
)

Getter for the record component value.

public short

Returns:

the value of the field
getShort
(Object
the object instance (must not be null, must be of the correct type)
instance
)

Get the short value of this field on the given object instance.

public Class<?>

Returns:

the field type
getType
()

Get the field type.

public boolean

Returns:

true if this object may be used to get or set an object field value, false otherwise
isAccessible
()

Determine if this object may be used to get or set an object field value.

public boolean

Returns:

true if the field is unshared
isUnshared
()

Determine whether this field is marked as "unshared".

public void
readFrom(Object
the instance
instance
,
ObjectInput
the source stream
input
)

Read the field value from the stream.

public void
setBoolean(Object
the object instance (must not be null, must be of the correct type)
instance
,
boolean
the value to set
value
)

Set the boolean value of this field on the given object instance.

public void
setByte(Object
the object instance (must not be null, must be of the correct type)
instance
,
byte
the value to set
value
)

Set the byte value of this field on the given object instance.

public void
setChar(Object
the object instance (must not be null, must be of the correct type)
instance
,
char
the value to set
value
)

Set the char value of this field on the given object instance.

public void
setDouble(Object
the object instance (must not be null, must be of the correct type)
instance
,
double
the value to set
value
)

Set the double value of this field on the given object instance.

public void
setFloat(Object
the object instance (must not be null, must be of the correct type)
instance
,
float
the value to set
value
)

Set the float value of this field on the given object instance.

public void
setInt(Object
the object instance (must not be null, must be of the correct type)
instance
,
int
the value to set
value
)

Set the integer value of this field on the given object instance.

public void
setLong(Object
the object instance (must not be null, must be of the correct type)
instance
,
long
the value to set
value
)

Set the long value of this field on the given object instance.

public void
setObject(Object
the object instance (must not be null, must be of the correct type)
instance
,
Object
the value to set
value
)

Set the object value of this field on the given object instance.

public void
setShort(Object
the object instance (must not be null, must be of the correct type)
instance
,
short
the value to set
value
)

Set the short value of this field on the given object instance.

public void
writeTo(Object instance, ObjectOutput output)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

fieldback to summary
private final Field field
fieldOffsetback to summary
private final long fieldOffset
kindback to summary
private final Kind kind
nameback to summary
private final String name
recordComponentIndexback to summary
private final int recordComponentIndex
typeback to summary
private final Class<?> type
unsafeback to summary
pack-priv static final Unsafe unsafe
unsharedback to summary
private final boolean unshared

Constructor Detail

SerializableFieldback to summary
public SerializableField(Class<?> type, String name, boolean unshared)
SerializableFieldback to summary
pack-priv SerializableField(Class<?> type, String name, boolean unshared, final Field field, SerializableField.RecordComponent recordComponent)

Method Detail

getBooleanback to summary
public boolean getBoolean(Object instance) throws ClassCastException, IllegalArgumentException

Get the boolean value of this field on the given object instance.

Parameters
instance:Object

the object instance (must not be null, must be of the correct type)

Returns:boolean

the value of the field

Exceptions
ClassCastException:
if the field is not of the correct type
IllegalArgumentException:
if this instance has no reflection field set on it
getByteback to summary
public byte getByte(Object instance) throws ClassCastException, IllegalArgumentException

Get the byte value of this field on the given object instance.

Parameters
instance:Object

the object instance (must not be null, must be of the correct type)

Returns:byte

the value of the field

Exceptions
ClassCastException:
if the field is not of the correct type
IllegalArgumentException:
if this instance has no reflection field set on it
getCharback to summary
public char getChar(Object instance) throws ClassCastException, IllegalArgumentException

Get the char value of this field on the given object instance.

Parameters
instance:Object

the object instance (must not be null, must be of the correct type)

Returns:char

the value of the field

Exceptions
ClassCastException:
if the field is not of the correct type
IllegalArgumentException:
if this instance has no reflection field set on it
getDoubleback to summary
public double getDouble(Object instance) throws ClassCastException, IllegalArgumentException

Get the double value of this field on the given object instance.

Parameters
instance:Object

the object instance (must not be null, must be of the correct type)

Returns:double

the value of the field

Exceptions
ClassCastException:
if the field is not of the correct type
IllegalArgumentException:
if this instance has no reflection field set on it
getFieldback to summary
public Field getField()

Deprecated

As of Java 9, accessible fields are generally disallowed; use the #setXXX(Object,value) methods instead.

Get the reflection Field for this serializable field. The resultant field will be accessible.

Returns:Field

the reflection field

Annotations
@Deprecated
getFloatback to summary
public float getFloat(Object instance) throws ClassCastException, IllegalArgumentException

Get the float value of this field on the given object instance.

Parameters
instance:Object

the object instance (must not be null, must be of the correct type)

Returns:float

the value of the field

Exceptions
ClassCastException:
if the field is not of the correct type
IllegalArgumentException:
if this instance has no reflection field set on it
getIntback to summary
public int getInt(Object instance) throws ClassCastException, IllegalArgumentException

Get the integer value of this field on the given object instance.

Parameters
instance:Object

the object instance (must not be null, must be of the correct type)

Returns:int

the value of the field

Exceptions
ClassCastException:
if the field is not of the correct type
IllegalArgumentException:
if this instance has no reflection field set on it
getKindback to summary
public Kind getKind()

Get the kind of field.

Returns:Kind

the kind

getLongback to summary
public long getLong(Object instance) throws ClassCastException, IllegalArgumentException

Get the long value of this field on the given object instance.

Parameters
instance:Object

the object instance (must not be null, must be of the correct type)

Returns:long

the value of the field

Exceptions
ClassCastException:
if the field is not of the correct type
IllegalArgumentException:
if this instance has no reflection field set on it
getNameback to summary
public String getName()

Get the name of the field.

Returns:String

the name

getObjectback to summary
public Object getObject(Object instance) throws ClassCastException, IllegalArgumentException

Get the object value of this field on the given object instance.

Parameters
instance:Object

the object instance (must not be null, must be of the correct type)

Returns:Object

the value of the field

Exceptions
ClassCastException:
if the field is not of the correct type
IllegalArgumentException:
if this instance has no reflection field set on it
getRecordComponentIndexback to summary
public int getRecordComponentIndex()

Getter for the record component index.

Returns:int

The record component index or -1

getRecordComponentValueback to summary
public Object getRecordComponentValue(Object obj)

Getter for the record component value.

Parameters
obj:Object

The object to obtain the record component value

Returns:Object

The record component value for this obj

getShortback to summary
public short getShort(Object instance) throws ClassCastException, IllegalArgumentException

Get the short value of this field on the given object instance.

Parameters
instance:Object

the object instance (must not be null, must be of the correct type)

Returns:short

the value of the field

Exceptions
ClassCastException:
if the field is not of the correct type
IllegalArgumentException:
if this instance has no reflection field set on it
getTypeback to summary
public Class<?> getType() throws ClassNotFoundException

Get the field type.

Returns:Class<?>

the field type

isAccessibleback to summary
public boolean isAccessible()

Determine if this object may be used to get or set an object field value.

Returns:boolean

true if this object may be used to get or set an object field value, false otherwise

isUnsharedback to summary
public boolean isUnshared()

Determine whether this field is marked as "unshared".

Returns:boolean

true if the field is unshared

readFromback to summary
public void readFrom(Object instance, ObjectInput input) throws IOException, ClassNotFoundException

Read the field value from the stream.

Parameters
instance:Object

the instance

input:ObjectInput

the source stream

Exceptions
IOException:
if an I/O error occurs
ClassNotFoundException:
if a class could not be loaded
setBooleanback to summary
public void setBoolean(Object instance, boolean value) throws ClassCastException, IllegalArgumentException

Set the boolean value of this field on the given object instance.

Parameters
instance:Object

the object instance (must not be null, must be of the correct type)

value:boolean

the value to set

Exceptions
ClassCastException:
if instance or the field is not of the correct type
IllegalArgumentException:
if this instance has no reflection field set on it
setByteback to summary
public void setByte(Object instance, byte value) throws ClassCastException, IllegalArgumentException

Set the byte value of this field on the given object instance.

Parameters
instance:Object

the object instance (must not be null, must be of the correct type)

value:byte

the value to set

Exceptions
ClassCastException:
if instance is not of the correct type
IllegalArgumentException:
if this instance has no reflection field set on it
setCharback to summary
public void setChar(Object instance, char value) throws ClassCastException, IllegalArgumentException

Set the char value of this field on the given object instance.

Parameters
instance:Object

the object instance (must not be null, must be of the correct type)

value:char

the value to set

Exceptions
ClassCastException:
if instance or the field is not of the correct type
IllegalArgumentException:
if this instance has no reflection field set on it
setDoubleback to summary
public void setDouble(Object instance, double value) throws ClassCastException, IllegalArgumentException

Set the double value of this field on the given object instance.

Parameters
instance:Object

the object instance (must not be null, must be of the correct type)

value:double

the value to set

Exceptions
ClassCastException:
if instance or the field is not of the correct type
IllegalArgumentException:
if this instance has no reflection field set on it
setFloatback to summary
public void setFloat(Object instance, float value) throws ClassCastException, IllegalArgumentException

Set the float value of this field on the given object instance.

Parameters
instance:Object

the object instance (must not be null, must be of the correct type)

value:float

the value to set

Exceptions
ClassCastException:
if instance or the field is not of the correct type
IllegalArgumentException:
if this instance has no reflection field set on it
setIntback to summary
public void setInt(Object instance, int value) throws ClassCastException, IllegalArgumentException

Set the integer value of this field on the given object instance.

Parameters
instance:Object

the object instance (must not be null, must be of the correct type)

value:int

the value to set

Exceptions
ClassCastException:
if instance or the field is not of the correct type
IllegalArgumentException:
if this instance has no reflection field set on it
setLongback to summary
public void setLong(Object instance, long value) throws ClassCastException, IllegalArgumentException

Set the long value of this field on the given object instance.

Parameters
instance:Object

the object instance (must not be null, must be of the correct type)

value:long

the value to set

Exceptions
ClassCastException:
if instance or the field is not of the correct type
IllegalArgumentException:
if this instance has no reflection field set on it
setObjectback to summary
public void setObject(Object instance, Object value) throws ClassCastException, IllegalArgumentException

Set the object value of this field on the given object instance.

Parameters
instance:Object

the object instance (must not be null, must be of the correct type)

value:Object

the value to set

Exceptions
ClassCastException:
if instance or the field is not of the correct type
IllegalArgumentException:
if this instance has no reflection field set on it
setShortback to summary
public void setShort(Object instance, short value) throws ClassCastException, IllegalArgumentException

Set the short value of this field on the given object instance.

Parameters
instance:Object

the object instance (must not be null, must be of the correct type)

value:short

the value to set

Exceptions
ClassCastException:
if instance or the field is not of the correct type
IllegalArgumentException:
if this instance has no reflection field set on it
writeToback to summary
public void writeTo(Object instance, ObjectOutput output) throws IOException
org.jboss.marshalling.reflect back to summary

pack-priv final Class SerializableField.RecordComponent

extends Object
Class Inheritance
  • java.lang.Object
  • org.jboss.marshalling.reflect.SerializableField.RecordComponent

A record component, which has a name, type and index.

Field Summary

Modifier and TypeField and Description
private final int
private final String
private final Class<?>

Constructor Summary

AccessConstructor and Description
pack-priv
RecordComponent(String name, Class<?> type, int index)

Method Summary

Modifier and TypeMethod and Description
public int
public String
public Class<?>
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

indexback to summary
private final int index
nameback to summary
private final String name
typeback to summary
private final Class<?> type

Constructor Detail

RecordComponentback to summary
pack-priv RecordComponent(String name, Class<?> type, int index)

Method Detail

getIndexback to summary
public int getIndex()
getNameback to summary
public String getName()
getTypeback to summary
public Class<?> getType()