public final class CopyObjectExtensions extends Object
CopyObjectExtensions provide methods for copy an original object to a given
destination object.| Constructor and Description |
|---|
CopyObjectExtensions() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
closeOutputStream(OutputStream out)
Closes the given OutputStream.
|
static <ORIGINAL,DESTINATION> |
copy(ORIGINAL original,
DESTINATION destination)
Copy the given original object to the given destination object.
|
static <ORIGINAL,DESTINATION> |
copyPropertyWithReflection(ORIGINAL original,
DESTINATION destination,
String fieldName)
Copy the given original object to the given destination object.
|
static <ORIGINAL,DESTINATION> |
copyQuietly(ORIGINAL original,
DESTINATION destination)
Copy quietly the given original object to the given destination object.
|
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 <DESTINATION,ORIGINAL> |
isCopyable(ORIGINAL original,
DESTINATION destination)
Checks if is copyable and copies if its possible otherwise it returns false.
|
public static final <ORIGINAL,DESTINATION> DESTINATION copyPropertyWithReflection(ORIGINAL original,
DESTINATION destination,
String fieldName)
throws NoSuchFieldException,
SecurityException,
IllegalArgumentException,
IllegalAccessException
ORIGINAL - the generic type of the original object.DESTINATION - the generic type of the destination object.original - the original object.destination - the destination object.fieldName - the field nameNoSuchFieldException - is thrown if no such field exists.SecurityException - is thrown if a security manager says no.IllegalArgumentException - if the destination or original argument is null or if
the destination property type is different from the source type and
the relevant converter has not been registered.IllegalAccessException - if the caller does not have access to the property accessor methodpublic static final <ORIGINAL,DESTINATION> DESTINATION copy(ORIGINAL original,
DESTINATION destination)
throws IllegalAccessException,
InvocationTargetException,
IllegalArgumentException
DESTINATION - the generic type of the destination object.ORIGINAL - the generic type of the original object.original - the original object.destination - the destination object.IllegalAccessException - if the caller does not have access to the property accessor methodInvocationTargetException - if the property accessor method throws an exceptionIllegalArgumentException - if the destination or original argument is null or if
the destination property type is different from the source type and
the relevant converter has not been registered.public static final <ORIGINAL,DESTINATION> DESTINATION copyQuietly(ORIGINAL original,
DESTINATION destination)
DESTINATION - the generic type of the destination object.ORIGINAL - the generic type of the original object.original - the original object.destination - the destination object.public static final <DESTINATION,ORIGINAL> boolean isCopyable(ORIGINAL original,
DESTINATION destination)
DESTINATION - the generic type of the destination object.ORIGINAL - the generic type of the original object.original - the original object.destination - the destination object.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 boolean closeOutputStream(OutputStream out)
out - The OutputStream to close.Copyright © 2015–2018 Alpha Ro Group UG (haftungsbeschrÀngt). All rights reserved.