Package org.jboss.marshalling.reflect
Class SerializableClass
java.lang.Object
org.jboss.marshalling.reflect.SerializableClass
Reflection information about a serializable class. Intended for use by implementations of the Marshalling API.
- Author:
- Richard Opalka
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionInvoke the no-arg constructor on this class.callNonInitConstructor(Class<?> target) Invoke the non-init constructor on this class.callObjectInputConstructor(ObjectInput objectInput) Invoke the public constructor accepting an ObjectInput.voidcallReadObject(Object object, ObjectInputStream inputStream) Invoke thereadObject()method for an object.voidcallReadObjectNoData(Object object) Invoke thereadObjectNoData()method for an object.callReadResolve(Object object) Invoke thereadResolve()method for an object.voidcallWriteObject(Object object, ObjectOutputStream outputStream) Invoke thewriteObject()method for an object.callWriteReplace(Object object) Invoke thewriteReplace()method for an object.longGet the effective serial version UID of this class.Get the serializable fields of this class.getSerializableField(String name, Class<?> fieldType, boolean unshared) Create a synthetic field for this object class.Class<?>Get theClassof this class.booleanhasNoInitConstructor(Class<?> target) Determine whether this class has a non-init constructor.booleanDetermine whether this class has a public constructor accepting an ObjectInput.booleanDetermine whether this class has a public no-arg constructor.booleanDetermine whether this class has areadObject()method.booleanDetermine whether this class has areadObjectNoData()method.booleanDetermine whether this class has areadResolve()method.booleanDetermine whether this class has awriteObject()method.booleanDetermine whether this class has awriteReplace()method.Invokes the record constructor for this class.booleanisRecord()Determine if this class is a record.toString()
-
Field Details
-
NOFIELDS
An empty array of fields.
-
-
Method Details
-
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:
- the fields
-
getSerializableField
public SerializableField getSerializableField(String name, Class<?> fieldType, boolean unshared) throws ClassNotFoundException Create a synthetic field for this object class.- Parameters:
name- the name of the fieldfieldType- the field typeunshared-trueif the field should be unshared- Returns:
- the field
- Throws:
ClassNotFoundException- if a class was not found while looking up the subject class
-
hasWriteObject
public boolean hasWriteObject()Determine whether this class has awriteObject()method.- Returns:
trueif there is awriteObject()method
-
callWriteObject
Invoke thewriteObject()method for an object.- Parameters:
object- the object to invoke onoutputStream- the object output stream to pass in- Throws:
IOException- if an I/O error occurs
-
hasReadObject
public boolean hasReadObject()Determine whether this class has areadObject()method.- Returns:
trueif there is areadObject()method
-
callReadObject
public void callReadObject(Object object, ObjectInputStream inputStream) throws IOException, ClassNotFoundException Invoke thereadObject()method for an object.- Parameters:
object- the object to invoke oninputStream- the object input stream to pass in- Throws:
IOException- if an I/O error occursClassNotFoundException- if a class was not able to be loaded
-
hasReadObjectNoData
public boolean hasReadObjectNoData()Determine whether this class has areadObjectNoData()method.- Returns:
trueif there is areadObjectNoData()method
-
callReadObjectNoData
Invoke thereadObjectNoData()method for an object.- Parameters:
object- the object to invoke on- Throws:
ObjectStreamException- if an I/O error occurs
-
hasWriteReplace
public boolean hasWriteReplace()Determine whether this class has awriteReplace()method.- Returns:
trueif there is awriteReplace()method
-
callWriteReplace
Invoke thewriteReplace()method for an object.- Parameters:
object- the object to invoke on- Returns:
- the nominated replacement object
- Throws:
ObjectStreamException- if an I/O error occurs
-
hasReadResolve
public boolean hasReadResolve()Determine whether this class has areadResolve()method.- Returns:
trueif there is areadResolve()method
-
callReadResolve
Invoke thereadResolve()method for an object.- Parameters:
object- the object to invoke on- Returns:
- the original object
- Throws:
ObjectStreamException- if an I/O error occurs
-
hasPublicNoArgConstructor
public boolean hasPublicNoArgConstructor()Determine whether this class has a public no-arg constructor.- Returns:
trueif there is such a constructor
-
callNoArgConstructor
Invoke the no-arg constructor on this class.- Returns:
- the new instance
- Throws:
IOException- if an I/O error occurs
-
hasObjectInputConstructor
public boolean hasObjectInputConstructor()Determine whether this class has a public constructor accepting an ObjectInput.- Returns:
trueif there is such a constructor
-
callObjectInputConstructor
Invoke the public constructor accepting an ObjectInput.- Parameters:
objectInput- the ObjectInput to pass to the constructor- Returns:
- the new instance
- Throws:
IOException- if an I/O error occurs
-
hasNoInitConstructor
Determine whether this class has a non-init constructor.- Returns:
- whether this class has a non-init constructor
-
callNonInitConstructor
Invoke the non-init constructor on this class.- Returns:
- the new instance
-
getEffectiveSerialVersionUID
public long getEffectiveSerialVersionUID()Get the effective serial version UID of this class.- Returns:
- the serial version UID
-
getSubjectClass
Get theClassof this class.- Returns:
- the subject class
-
toString
-
isRecord
public boolean isRecord()Determine if this class is a record.- Returns:
- The record components or null
-
invokeRecordCanonicalConstructor
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- The record arguments for the constructor- Returns:
- The new record created
-