public final class SerializedObjectUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
protected static Logger |
LOGGER
The LOGGER.
|
| Modifier and Type | Method and Description |
|---|---|
static <T extends Serializable> |
copySerializedObject(T orig)
Copys the given Object and returns the copy from the object or null if the object can't be
serialized.
|
static List<SerializedChangedAttributeResult> |
getChangedData(Object sourceOjbect,
Object objectToCompare)
Gets the changed data.
|
static Map<Object,SerializedChangedAttributeResult> |
getChangedDataMap(Object sourceOjbect,
Object objectToCompare)
Compares the given two objects and gets the changed data.
|
static Object |
readSerializedObjectFromFile(File file)
Reads the object from the given file.
|
static <T> byte[] |
toByteArray(T object)
The Method toByteArray() serialize an Object to byte array.
|
static Object |
toObject(byte[] byteArray)
The Method toObject() converts the given byte array into an Object.
|
static boolean |
writeSerializedObjectToFile(Object obj,
File file)
Writes the given object to the given File.
|
protected static final Logger LOGGER
public static <T extends Serializable> T copySerializedObject(T orig) throws IOException, ClassNotFoundException
T - the generic type of the given objectorig - The object to copy.IOException - Signals that an I/O exception has occurred.ClassNotFoundException - is thrown when a class is not found in the classloader or no definition for the
class with the specified name could be found.public static List<SerializedChangedAttributeResult> getChangedData(Object sourceOjbect, Object objectToCompare) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException
sourceOjbect - the source ojbectobjectToCompare - the object to compareIllegalAccessException - the illegal access exceptionInvocationTargetException - the invocation target exceptionNoSuchMethodException - the no such method exceptionpublic static Map<Object,SerializedChangedAttributeResult> getChangedDataMap(Object sourceOjbect, Object objectToCompare) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException
sourceOjbect - the source ojbectobjectToCompare - the object to compareIllegalAccessException - the illegal access exceptionInvocationTargetException - the invocation target exceptionNoSuchMethodException - the no such method exceptionpublic static Object readSerializedObjectFromFile(File file) throws IOException, ClassNotFoundException
file - In that file is the object saved.IOException - Signals that an I/O exception has occurred.ClassNotFoundException - is thrown when a class is not found in the classloader or no definition for the
class with the specified name could be found.public static <T> byte[] toByteArray(T object)
throws IOException
T - the generic type of the given objectobject - The Object to convert into a byte array.IOException - Signals that an I/O exception has occurred.public static Object toObject(byte[] byteArray) throws IOException, ClassNotFoundException
byteArray - The byte array to convert into an Object.IOException - Signals that an I/O exception has occurred.ClassNotFoundException - is thrown when a class is not found in the classloader or no definition for the
class with the specified name could be found.public static boolean writeSerializedObjectToFile(Object obj, File file) throws IOException
obj - The object to write to the File.file - In this file will be the object saved.IOException - Signals that an I/O exception has occurred.Copyright © 2007–2015 Alpha Ro Group UG (haftungsbeschrÀngt). All rights reserved.