Package org.keycloak.models.map.common
Class DeepCloner.Builder
java.lang.Object
org.keycloak.models.map.common.DeepCloner.Builder
- Enclosing class:
- DeepCloner
Builder for the
DeepCloner
helper class.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Returns aDeepCloner
initialized with the respective constructors and cloners.cloner
(Class<? extends V> clazz, DeepCloner.Cloner<?> cloner) Adds a method that copies (as in a deep copy) an object properties from one object to anothercloner
(Class<? extends V> clazz, DeepCloner.Cloner<?> clonerWithId, DeepCloner.Cloner<?> clonerWithoutId) Adds a method that copies (as in a deep copy) an object properties from one object to anotherconstructor
(Class<V> clazz, Function<DeepCloner, ? extends V> constructor) Adds a method, often a constructor, that instantiates a record of typeV
.delegateCreator
(Class<V> clazz, DeepCloner.DelegateCreator<V> delegateCreator) Adds a method, often a constructor, that instantiates a delegate of typeV
.delegateCreator
(Class<V> clazz, DeepCloner.EntityFieldDelegateCreator<V> delegateCreator) Adds a method that instantiates an per-field delegate of typeV
.genericCloner
(DeepCloner.Cloner<V> genericCloner) Adds a method that copies (as in a deep copy) an object properties to another object for any class that is not covered by a specific cloner set via#cloner(Class, BiFunction)
method.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
build
Returns aDeepCloner
initialized with the respective constructors and cloners.- Returns:
-
constructor
public <V> DeepCloner.Builder constructor(Class<V> clazz, Function<DeepCloner, ? extends V> constructor) Adds a method, often a constructor, that instantiates a record of typeV
.- Type Parameters:
V
- Class or interface that would be instantiated by the given methods- Parameters:
clazz
- Class or interface that would be instantiated by the given methodsconstructor
- Function that creates a new instance of classV
. Ifnull
, such a single-parameter constructor is not available.- Returns:
- This builder.
-
delegateCreator
public <V> DeepCloner.Builder delegateCreator(Class<V> clazz, DeepCloner.EntityFieldDelegateCreator<V> delegateCreator) Adds a method that instantiates an per-field delegate of typeV
.- Type Parameters:
V
- Class or interface that would be instantiated by the given methods- Parameters:
clazz
- Class or interface that would be instantiated by the given methodsdelegateCreator
- Function that creates a new instance of classV
. Ifnull
, such a single-parameter constructor is not available.- Returns:
- This builder.
-
delegateCreator
public <V> DeepCloner.Builder delegateCreator(Class<V> clazz, DeepCloner.DelegateCreator<V> delegateCreator) Adds a method, often a constructor, that instantiates a delegate of typeV
.- Type Parameters:
V
- Class or interface that would be instantiated by the given methods- Parameters:
clazz
- Class or interface that would be instantiated by the given methodsdelegateCreator
- Function that creates a new instance of classV
. Ifnull
, such a single-parameter constructor is not available.- Returns:
- This builder.
-
cloner
Adds a method that copies (as in a deep copy) an object properties from one object to another- Type Parameters:
V
- Class or interface whose instance would be copied over to another instance by the given cloner- Parameters:
clazz
- Class or interface whose instance would be copied over to another instance by the given clonercloner
- A method for cloning with the following signature:V deepClone(V from, V to)
which copies properties of an objectfrom
onto the objectto
. This function usually returnsto
- Returns:
- This builder.
-
cloner
public <V> DeepCloner.Builder cloner(Class<? extends V> clazz, DeepCloner.Cloner<?> clonerWithId, DeepCloner.Cloner<?> clonerWithoutId) Adds a method that copies (as in a deep copy) an object properties from one object to another- Type Parameters:
V
- Class or interface whose instance would be copied over to another instance by the given cloner- Parameters:
clazz
- Class or interface whose instance would be copied over to another instance by the given clonerclonerWithId
- A method for cloning with the following signature:V deepClone(V from, V to)
which copies properties of an objectfrom
onto the objectto
. This function usually returnsto
- Returns:
- This builder.
-
genericCloner
Adds a method that copies (as in a deep copy) an object properties to another object for any class that is not covered by a specific cloner set via#cloner(Class, BiFunction)
method.- Type Parameters:
V
- Class or interface whose instance would be copied over to another instance by the given cloner- Parameters:
genericCloner
- A method for cloning which copies properties of an object onto another object. This function usually returnsto
- Returns:
- This builder.
-