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

public final Class SerializableClass

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

Reflection information about a serializable class. Intended for use by implementations of the Marshalling API.
Author
Richard Opalka

Field Summary

Modifier and TypeField and Description
private final long
private static final IdentityHashMap<Class<?>, Constructor<?>>
private final SerializableField[]
private final Map<String, SerializableField>
private final boolean
private static final Comparator<? super SerializableField>
public static final SerializableField[]
NOFIELDS

An empty array of fields.

private final IdentityHashMap<Class<?>, Constructor<?>>
private static final SerializableClassRegistry
private final JDKSpecific.SerMethods
private final Class<?>
private static final Unsafe

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public Object

Returns:

the new instance
callNoArgConstructor
()

Invoke the no-arg constructor on this class.

public Object

Returns:

the new instance
callNonInitConstructor
(Class<?> target)

Invoke the non-init constructor on this class.

public Object

Returns:

the new instance
callObjectInputConstructor
(final ObjectInput
the ObjectInput to pass to the constructor
objectInput
)

Invoke the public constructor accepting an ObjectInput.

public void
callReadObject(Object
the object to invoke on
object
,
ObjectInputStream
the object input stream to pass in
inputStream
)

Invoke the readObject() method for an object.

public void
callReadObjectNoData(Object
the object to invoke on
object
)

Invoke the readObjectNoData() method for an object.

public Object

Returns:

the original object
callReadResolve
(Object
the object to invoke on
object
)

Invoke the readResolve() method for an object.

public void
callWriteObject(Object
the object to invoke on
object
,
ObjectOutputStream
the object output stream to pass in
outputStream
)

Invoke the writeObject() method for an object.

public Object

Returns:

the nominated replacement object
callWriteReplace
(Object
the object to invoke on
object
)

Invoke the writeReplace() method for an object.

private static ObjectStreamField[]
public long

Returns:

the serial version UID
getEffectiveSerialVersionUID
()

Get the effective serial version UID of this class.

public SerializableField[]

Returns:

the fields
getFields
()

Get the serializable fields of this class.

pack-priv <T> Constructor<T>
pack-priv <T> Constructor<T>
public SerializableField

Returns:

the field
getSerializableField
(String
the name of the field
name
,
Class<?>
the field type
fieldType
,
boolean
true if the field should be unshared
unshared
)

Create a synthetic field for this object class.

public SerializableField

Returns:

the field or null if there is one with that name
getSerializableFieldByName
(String
the name of the field
name
)

Find a field for this object class by name.

private static SerializableField[]
getSerializableFields(Class<?> clazz, boolean isRecord)

pack-priv JDKSpecific.SerMethods
public Class<?>

Returns:

the subject class
getSubjectClass
()

Get the Class of this class.

public boolean

Returns:

whether this class has a non-init constructor
hasNoInitConstructor
(Class<?> target)

Determine whether this class has a non-init constructor.

public boolean

Returns:

true if there is such a constructor
hasObjectInputConstructor
()

Determine whether this class has a public constructor accepting an ObjectInput.

public boolean

Returns:

true if there is such a constructor
hasPublicNoArgConstructor
()

Determine whether this class has a public no-arg constructor.

public boolean

Returns:

true if there is a readObject() method
hasReadObject
()

Determine whether this class has a readObject() method.

public boolean

Returns:

true if there is a readObjectNoData() method
hasReadObjectNoData
()

Determine whether this class has a readObjectNoData() method.

public boolean

Returns:

true if there is a readResolve() method
hasReadResolve
()

Determine whether this class has a readResolve() method.

public boolean

Returns:

true if there is a writeObject() method
hasWriteObject
()

Determine whether this class has a writeObject() method.

public boolean

Returns:

true if there is a writeReplace() method
hasWriteReplace
()

Determine whether this class has a writeReplace() method.

private static <T> T
invokeConstructor(Constructor<T> constructor, Object... args)

private static <T> T
public Object

Returns:

The new record created
invokeRecordCanonicalConstructor
(Object[]
The record arguments for the constructor
args
)

Invokes the record constructor for this class.

public boolean

Returns:

The record components or null
isRecord
()

Determine if this class is a record.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

effectiveSerialVersionUIDback to summary
private final long effectiveSerialVersionUID
EMPTY_IHMback to summary
private static final IdentityHashMap<Class<?>, Constructor<?>> EMPTY_IHM
fieldsback to summary
private final SerializableField[] fields
fieldsByNameback to summary
private final Map<String, SerializableField> fieldsByName
isRecordback to summary
private final boolean isRecord
NAME_COMPARATORback to summary
private static final Comparator<? super SerializableField> NAME_COMPARATOR
NOFIELDSback to summary
public static final SerializableField[] NOFIELDS

An empty array of fields.

nonInitConstructorsback to summary
private final IdentityHashMap<Class<?>, Constructor<?>> nonInitConstructors
REGISTRYback to summary
private static final SerializableClassRegistry REGISTRY
serMethodsback to summary
private final JDKSpecific.SerMethods serMethods
subjectback to summary
private final Class<?> subject
unsafeback to summary
private static final Unsafe unsafe

Constructor Detail

SerializableClassback to summary
pack-priv SerializableClass(Class<?> subject)

Method Detail

callNoArgConstructorback to summary
public Object callNoArgConstructor() throws IOException

Invoke the no-arg constructor on this class.

Returns:Object

the new instance

Exceptions
IOException:
if an I/O error occurs
callNonInitConstructorback to summary
public Object callNonInitConstructor(Class<?> target)

Invoke the non-init constructor on this class.

Returns:Object

the new instance

callObjectInputConstructorback to summary
public Object callObjectInputConstructor(final ObjectInput objectInput) throws IOException

Invoke the public constructor accepting an ObjectInput.

Parameters
objectInput:ObjectInput

the ObjectInput to pass to the constructor

Returns:Object

the new instance

Exceptions
IOException:
if an I/O error occurs
callReadObjectback to summary
public void callReadObject(Object object, ObjectInputStream inputStream) throws IOException, ClassNotFoundException

Invoke the readObject() method for an object.

Parameters
object:Object

the object to invoke on

inputStream:ObjectInputStream

the object input stream to pass in

Exceptions
IOException:
if an I/O error occurs
ClassNotFoundException:
if a class was not able to be loaded
callReadObjectNoDataback to summary
public void callReadObjectNoData(Object object) throws ObjectStreamException

Invoke the readObjectNoData() method for an object.

Parameters
object:Object

the object to invoke on

Exceptions
ObjectStreamException:
if an I/O error occurs
callReadResolveback to summary
public Object callReadResolve(Object object) throws ObjectStreamException

Invoke the readResolve() method for an object.

Parameters
object:Object

the object to invoke on

Returns:Object

the original object

Exceptions
ObjectStreamException:
if an I/O error occurs
callWriteObjectback to summary
public void callWriteObject(Object object, ObjectOutputStream outputStream) throws IOException

Invoke the writeObject() method for an object.

Parameters
object:Object

the object to invoke on

outputStream:ObjectOutputStream

the object output stream to pass in

Exceptions
IOException:
if an I/O error occurs
callWriteReplaceback to summary
public Object callWriteReplace(Object object) throws ObjectStreamException

Invoke the writeReplace() method for an object.

Parameters
object:Object

the object to invoke on

Returns:Object

the nominated replacement object

Exceptions
ObjectStreamException:
if an I/O error occurs
getDeclaredSerialPersistentFieldsback to summary
private static ObjectStreamField[] getDeclaredSerialPersistentFields(Class<?> clazz)
getEffectiveSerialVersionUIDback to summary
public long getEffectiveSerialVersionUID()

Get the effective serial version UID of this class.

Returns:long

the serial version UID

getFieldsback to summary
public SerializableField[] getFields()

Get the serializable fields of this class. The returned array is a direct reference, so care should be taken not to modify it.

Returns:SerializableField[]

the fields

getNoArgConstructorback to summary
pack-priv <T> Constructor<T> getNoArgConstructor()
Annotations
@SuppressWarnings:unchecked
getNoInitConstructorback to summary
pack-priv <T> Constructor<T> getNoInitConstructor()
Annotations
@SuppressWarnings:unchecked
getSerializableFieldback to summary
public SerializableField getSerializableField(String name, Class<?> fieldType, boolean unshared) throws ClassNotFoundException

Create a synthetic field for this object class.

Parameters
name:String

the name of the field

fieldType:Class<?>

the field type

unshared:boolean

true if the field should be unshared

Returns:SerializableField

the field

Exceptions
ClassNotFoundException:
if a class was not found while looking up the subject class
getSerializableFieldByNameback to summary
public SerializableField getSerializableFieldByName(String name) throws ClassNotFoundException

Find a field for this object class by name.

Parameters
name:String

the name of the field

Returns:SerializableField

the field or null if there is one with that name

Exceptions
ClassNotFoundException:
if a class was not found while looking up the subject class
getSerializableFieldsback to summary
private static SerializableField[] getSerializableFields(Class<?> clazz, boolean isRecord)
getSerMethodsback to summary
pack-priv JDKSpecific.SerMethods getSerMethods()
getSubjectClassback to summary
public Class<?> getSubjectClass()

Get the Class of this class.

Returns:Class<?>

the subject class

hasNoInitConstructorback to summary
public boolean hasNoInitConstructor(Class<?> target)

Determine whether this class has a non-init constructor.

Returns:boolean

whether this class has a non-init constructor

hasObjectInputConstructorback to summary
public boolean hasObjectInputConstructor()

Determine whether this class has a public constructor accepting an ObjectInput.

Returns:boolean

true if there is such a constructor

hasPublicNoArgConstructorback to summary
public boolean hasPublicNoArgConstructor()

Determine whether this class has a public no-arg constructor.

Returns:boolean

true if there is such a constructor

hasReadObjectback to summary
public boolean hasReadObject()

Determine whether this class has a readObject() method.

Returns:boolean

true if there is a readObject() method

hasReadObjectNoDataback to summary
public boolean hasReadObjectNoData()

Determine whether this class has a readObjectNoData() method.

Returns:boolean

true if there is a readObjectNoData() method

hasReadResolveback to summary
public boolean hasReadResolve()

Determine whether this class has a readResolve() method.

Returns:boolean

true if there is a readResolve() method

hasWriteObjectback to summary
public boolean hasWriteObject()

Determine whether this class has a writeObject() method.

Returns:boolean

true if there is a writeObject() method

hasWriteReplaceback to summary
public boolean hasWriteReplace()

Determine whether this class has a writeReplace() method.

Returns:boolean

true if there is a writeReplace() method

invokeConstructorback to summary
private static <T> T invokeConstructor(Constructor<T> constructor, Object... args) throws IOException
invokeConstructorNoExceptionback to summary
private static <T> T invokeConstructorNoException(Constructor<T> constructor, Object... args)
invokeRecordCanonicalConstructorback to summary
public Object invokeRecordCanonicalConstructor(Object[] args)

Invokes the record constructor for this class. If the class is not a record or the values are incorrect a IllegalStateException is thrown.

Parameters
args:Object[]

The record arguments for the constructor

Returns:Object

The new record created

isRecordback to summary
public boolean isRecord()

Determine if this class is a record.

Returns:boolean

The record components or null

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.