Class CloneUtil
java.lang.Object
com.webfirmframework.wffweb.clone.CloneUtil
A utility class for clone operations.
- Since:
- 1.0.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> T
deepClone
(T objectToBeClonned) static <T> T
deepCloneOnlyIfContains
(T objectToBeClonned, List<T> objects) clones only ifobjects
contains the givenobjectToBeClonned
, otherwise returns the same object.static <T> T
deepCloneOnlyIfContains
(T objectToBeClonned, Set<T> objects) clones only ifobjects
contains the givenobjectToBeClonned
, otherwise returns the same object.static <T> T
deepCloneOnlyIfContains
(T objectToBeClonned, T[] objects) clones only ifobjects
contains the givenobjectToBeClonned
, otherwise returns the same object.static <T> T
deepCloneOnlyIfDoesNotContain
(T objectToBeClonned, List<T> objects) clones only ifobjects
doesn't contain the givenobjectToBeClonned
, otherwise returns the same object.static <T> T
deepCloneOnlyIfDoesNotContain
(T objectToBeClonned, Set<T> objects) clones only ifobjects
doesn't contain the givenobjectToBeClonned
, otherwise returns the same object.static <T> T
deepCloneOnlyIfDoesNotContain
(T objectToBeClonned, T[] objects) clones only ifobjects
doesn't contain the givenobjectToBeClonned
, otherwise returns the same object.
-
Method Details
-
deepCloneOnlyIfContains
public static <T> T deepCloneOnlyIfContains(T objectToBeClonned, T[] objects) throws CloneNotSupportedException clones only ifobjects
contains the givenobjectToBeClonned
, otherwise returns the same object.- Parameters:
objectToBeClonned
- from which a new object will be cloned.null
will be returned for null value.objects
- to check if it containsobjectToBeClonned
.- Returns:
- the new cloned object only if
objects
contains the givenobjectToBeClonned
, otherwise returns the same object. IfobjectToBeClonned
is null then returnsnull
. Ifobjects
is null thenobjectToBeClonned
will be returned. - Throws:
CloneNotSupportedException
- Since:
- 1.0.0
-
deepCloneOnlyIfContains
public static <T> T deepCloneOnlyIfContains(T objectToBeClonned, List<T> objects) throws CloneNotSupportedException clones only ifobjects
contains the givenobjectToBeClonned
, otherwise returns the same object.- Parameters:
objectToBeClonned
- from which a new object will be cloned.null
will be returned for null value.objects
- to check if it containsobjectToBeClonned
.- Returns:
- the new cloned object only if
objects
contains the givenobjectToBeClonned
, otherwise returns the same object. IfobjectToBeClonned
is null then returnsnull
. Ifobjects
is null thenobjectToBeClonned
will be returned. - Throws:
CloneNotSupportedException
- Since:
- 1.0.0
-
deepCloneOnlyIfContains
public static <T> T deepCloneOnlyIfContains(T objectToBeClonned, Set<T> objects) throws CloneNotSupportedException clones only ifobjects
contains the givenobjectToBeClonned
, otherwise returns the same object.- Parameters:
objectToBeClonned
- from which a new object will be cloned.null
will be returned for null value.objects
- to check if it containsobjectToBeClonned
.- Returns:
- the new cloned object only if
objects
contains the givenobjectToBeClonned
, otherwise returns the same object. IfobjectToBeClonned
is null then returnsnull
. Ifobjects
is null thenobjectToBeClonned
will be returned. - Throws:
CloneNotSupportedException
- Since:
- 1.0.0
-
deepCloneOnlyIfDoesNotContain
public static <T> T deepCloneOnlyIfDoesNotContain(T objectToBeClonned, T[] objects) throws CloneNotSupportedException clones only ifobjects
doesn't contain the givenobjectToBeClonned
, otherwise returns the same object.- Parameters:
objectToBeClonned
- from which a new object will be cloned.null
will be returned for null value.objects
- to check if it doesn't containobjectToBeClonned
.- Returns:
- the new cloned object only if
objects
doesn't contain the givenobjectToBeClonned
, otherwise returns the same object. IfobjectToBeClonned
is null then returnsnull
. Ifobjects
is null then the cloned object will be returned. - Throws:
CloneNotSupportedException
- Since:
- 1.0.0
-
deepCloneOnlyIfDoesNotContain
public static <T> T deepCloneOnlyIfDoesNotContain(T objectToBeClonned, List<T> objects) throws CloneNotSupportedException clones only ifobjects
doesn't contain the givenobjectToBeClonned
, otherwise returns the same object.- Parameters:
objectToBeClonned
- from which a new object will be cloned.null
will be returned for null value.objects
- to check if it doesn't containobjectToBeClonned
.- Returns:
- the new cloned object only if
objects
doesn't contain the givenobjectToBeClonned
, otherwise returns the same object. IfobjectToBeClonned
is null then returnsnull
. Ifobjects
is null then the cloned object will be returned. - Throws:
CloneNotSupportedException
- Since:
- 1.0.0
-
deepCloneOnlyIfDoesNotContain
public static <T> T deepCloneOnlyIfDoesNotContain(T objectToBeClonned, Set<T> objects) throws CloneNotSupportedException clones only ifobjects
doesn't contain the givenobjectToBeClonned
, otherwise returns the same object.- Parameters:
objectToBeClonned
- from which a new object will be cloned.null
will be returned for null value.objects
- to check if it doesn't containobjectToBeClonned
.- Returns:
- the new cloned object only if
objects
doesn't contain the givenobjectToBeClonned
, otherwise returns the same object. IfobjectToBeClonned
is null then returnsnull
. Ifobjects
is null then the cloned object will be returned. - Throws:
CloneNotSupportedException
- Since:
- 1.0.0
-
deepClone
- Parameters:
objectToBeClonned
- from which a new object will be cloned.null
will be returned for null value.- Returns:
- the newly cloned object or
null
ifobjectToBeClonned
is null. - Throws:
CloneNotSupportedException
- Since:
- 1.0.0
-