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 <ORIGINAL,DESTINATION> |
copy(ORIGINAL original,
DESTINATION destination)
A delegate method to
copyProperties(Object, Object) for copy the
given original object to the given destination object. |
static <ORIGINAL,DESTINATION> |
copyProperties(ORIGINAL original,
DESTINATION destination)
Copy the given original object to the given destination object.
|
static <T> T |
copyProperties(T original)
Copy the given object and return a copy of it.
|
static <ORIGINAL,DESTINATION> |
copyPropertyWithReflection(ORIGINAL original,
DESTINATION destination,
String fieldName)
Copy 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.
|
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
copyProperties(Object, Object) for copy the
given original object to the given destination object.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 copyProperties(ORIGINAL original,
DESTINATION destination)
throws IllegalAccessException,
InvocationTargetException,
IllegalArgumentException
BeanUtils.copyProperties(Object, Object)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 <T> T copyProperties(T original)
throws IllegalAccessException,
InvocationTargetException,
IllegalArgumentException,
InstantiationException
BeanUtils.copyProperties(Object, Object) and create a new object for the returned
object.T - the generic type of the given object.original - the original 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.InstantiationException - Thrown if one of the following reasons: the class object
voidpublic 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.Copyright © 2015–2018 Alpha Ro Group UG (haftungsbeschrÀngt). All rights reserved.