public final class SerializableClass
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
private long |
effectiveSerialVersionUID |
private SerializableField[] |
fields |
private java.util.Map<java.lang.String,SerializableField> |
fieldsByName |
private static java.util.Comparator<? super SerializableField> |
NAME_COMPARATOR |
private java.lang.reflect.Constructor<?> |
noArgConstructor |
static SerializableField[] |
NOFIELDS
An empty array of fields.
|
private java.lang.reflect.Constructor<?> |
nonInitConstructor |
private java.lang.reflect.Constructor<?> |
objectInputConstructor |
private java.lang.reflect.Method |
readObject |
private java.lang.reflect.Method |
readObjectNoData |
private java.lang.reflect.Method |
readResolve |
private static sun.reflect.ReflectionFactory |
reflectionFactory |
private java.lang.Class<?> |
subject |
private java.lang.reflect.Method |
writeObject |
private java.lang.reflect.Method |
writeReplace |
| Constructor and Description |
|---|
SerializableClass(java.lang.Class<?> subject) |
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
callNoArgConstructor()
Invoke the public no-arg constructor on this class.
|
java.lang.Object |
callNonInitConstructor()
Invoke the non-init constructor on this class.
|
java.lang.Object |
callObjectInputConstructor(java.io.ObjectInput objectInput)
Invoke the public constructor accepting an ObjectInput.
|
void |
callReadObject(java.lang.Object object,
java.io.ObjectInputStream inputStream)
Invoke the
readObject() method for an object. |
void |
callReadObjectNoData(java.lang.Object object)
Invoke the
readObjectNoData() method for an object. |
java.lang.Object |
callReadResolve(java.lang.Object object)
Invoke the
readResolve() method for an object. |
void |
callWriteObject(java.lang.Object object,
java.io.ObjectOutputStream outputStream)
Invoke the
writeObject() method for an object. |
java.lang.Object |
callWriteReplace(java.lang.Object object)
Invoke the
writeReplace() method for an object. |
private static java.io.ObjectStreamField[] |
getDeclaredSerialPersistentFields(java.lang.Class<?> clazz) |
long |
getEffectiveSerialVersionUID()
Get the effective serial version UID of this class.
|
SerializableField[] |
getFields()
Get the serializable fields of this class.
|
(package private) <T> java.lang.reflect.Constructor<T> |
getNoArgConstructor() |
(package private) <T> java.lang.reflect.Constructor<T> |
getNoInitConstructor() |
SerializableField |
getSerializableField(java.lang.String name,
java.lang.Class<?> fieldType,
boolean unshared)
Create a synthetic field for this object class.
|
private static SerializableField[] |
getSerializableFields(java.lang.Class<?> clazz) |
java.lang.Class<?> |
getSubjectClass()
Get the
Class of this class. |
boolean |
hasNoArgConstructor()
Determine whether this class has a public no-arg constructor.
|
boolean |
hasNoInitConstructor()
Determine whether this class has a non-init constructor.
|
boolean |
hasObjectInputConstructor()
Determine whether this class has a public constructor accepting an ObjectInput.
|
boolean |
hasReadObject()
Determine whether this class has a
readObject() method. |
boolean |
hasReadObjectNoData()
Determine whether this class has a
readObjectNoData() method. |
boolean |
hasReadResolve()
Determine whether this class has a
readResolve() method. |
boolean |
hasWriteObject()
Determine whether this class has a
writeObject() method. |
boolean |
hasWriteReplace()
Determine whether this class has a
writeReplace() method. |
private static java.lang.Object |
invokeConstructor(java.lang.reflect.Constructor<?> constructor,
java.lang.Object... args) |
private static java.lang.Object |
invokeConstructorNoException(java.lang.reflect.Constructor<?> constructor,
java.lang.Object... args) |
private static <T> java.lang.reflect.Constructor<T> |
lookupNonInitConstructor(java.lang.Class<T> subject) |
java.lang.String |
toString() |
private static final sun.reflect.ReflectionFactory reflectionFactory
private final java.lang.Class<?> subject
private final java.lang.reflect.Method writeObject
private final java.lang.reflect.Method writeReplace
private final java.lang.reflect.Method readObject
private final java.lang.reflect.Method readObjectNoData
private final java.lang.reflect.Method readResolve
private final java.lang.reflect.Constructor<?> noArgConstructor
private final java.lang.reflect.Constructor<?> objectInputConstructor
private final java.lang.reflect.Constructor<?> nonInitConstructor
private final SerializableField[] fields
private final java.util.Map<java.lang.String,SerializableField> fieldsByName
private final long effectiveSerialVersionUID
private static final java.util.Comparator<? super SerializableField> NAME_COMPARATOR
public static final SerializableField[] NOFIELDS
private static SerializableField[] getSerializableFields(java.lang.Class<?> clazz)
private static java.io.ObjectStreamField[] getDeclaredSerialPersistentFields(java.lang.Class<?> clazz)
public SerializableField[] getFields()
public SerializableField getSerializableField(java.lang.String name, java.lang.Class<?> fieldType, boolean unshared) throws java.lang.ClassNotFoundException
name - the name of the fieldfieldType - the field typeunshared - true if the field should be unsharedjava.lang.ClassNotFoundException - if a class was not found while looking up the subject classpublic boolean hasWriteObject()
writeObject() method.true if there is a writeObject() methodpublic void callWriteObject(java.lang.Object object,
java.io.ObjectOutputStream outputStream)
throws java.io.IOException
writeObject() method for an object.object - the object to invoke onoutputStream - the object output stream to pass injava.io.IOException - if an I/O error occurspublic boolean hasReadObject()
readObject() method.true if there is a readObject() methodpublic void callReadObject(java.lang.Object object,
java.io.ObjectInputStream inputStream)
throws java.io.IOException,
java.lang.ClassNotFoundException
readObject() method for an object.object - the object to invoke oninputStream - the object input stream to pass injava.io.IOException - if an I/O error occursjava.lang.ClassNotFoundException - if a class was not able to be loadedpublic boolean hasReadObjectNoData()
readObjectNoData() method.true if there is a readObjectNoData() methodpublic void callReadObjectNoData(java.lang.Object object)
throws java.io.ObjectStreamException
readObjectNoData() method for an object.object - the object to invoke onjava.io.ObjectStreamException - if an I/O error occurspublic boolean hasWriteReplace()
writeReplace() method.true if there is a writeReplace() methodpublic java.lang.Object callWriteReplace(java.lang.Object object)
throws java.io.ObjectStreamException
writeReplace() method for an object.object - the object to invoke onjava.io.ObjectStreamException - if an I/O error occurspublic boolean hasReadResolve()
readResolve() method.true if there is a readResolve() methodpublic java.lang.Object callReadResolve(java.lang.Object object)
throws java.io.ObjectStreamException
readResolve() method for an object.object - the object to invoke onjava.io.ObjectStreamException - if an I/O error occurspublic boolean hasNoArgConstructor()
true if there is such a constructorpublic java.lang.Object callNoArgConstructor()
throws java.io.IOException
java.io.IOException - if an I/O error occurspublic boolean hasObjectInputConstructor()
true if there is such a constructorpublic java.lang.Object callObjectInputConstructor(java.io.ObjectInput objectInput)
throws java.io.IOException
objectInput - the ObjectInput to pass to the constructorjava.io.IOException - if an I/O error occurspublic boolean hasNoInitConstructor()
public java.lang.Object callNonInitConstructor()
private static java.lang.Object invokeConstructor(java.lang.reflect.Constructor<?> constructor,
java.lang.Object... args)
throws java.io.IOException
java.io.IOExceptionprivate static java.lang.Object invokeConstructorNoException(java.lang.reflect.Constructor<?> constructor,
java.lang.Object... args)
public long getEffectiveSerialVersionUID()
public java.lang.Class<?> getSubjectClass()
Class of this class.private static <T> java.lang.reflect.Constructor<T> lookupNonInitConstructor(java.lang.Class<T> subject)
<T> java.lang.reflect.Constructor<T> getNoInitConstructor()
<T> java.lang.reflect.Constructor<T> getNoArgConstructor()
public java.lang.String toString()
toString in class java.lang.Object