public final class EnumValuesUpdateActionUtils
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static <T extends io.sphere.sdk.models.WithKey,U> |
buildActions(java.lang.String definitionName,
java.util.List<T> oldEnumValues,
java.util.List<T> newEnumValues,
java.util.function.BiFunction<java.lang.String,java.util.List<java.lang.String>,io.sphere.sdk.commands.UpdateAction<U>> removeEnumCallback,
TriFunction<java.lang.String,T,T,java.util.List<io.sphere.sdk.commands.UpdateAction<U>>> matchingEnumCallback,
java.util.function.BiFunction<java.lang.String,T,io.sphere.sdk.commands.UpdateAction<U>> addEnumCallback,
java.util.function.BiFunction<java.lang.String,java.util.List<T>,io.sphere.sdk.commands.UpdateAction<U>> changeOrderEnumCallback,
java.util.function.BiFunction<java.lang.String,java.util.List<java.lang.String>,io.sphere.sdk.commands.UpdateAction<U>> changeOrderWithKeysEnumCallback)
Compares a list of old
oldEnumValues with a list of new newEnumValues for a
given definition. |
@Nonnull public static <T extends io.sphere.sdk.models.WithKey,U> java.util.List<io.sphere.sdk.commands.UpdateAction<U>> buildActions(@Nonnull java.lang.String definitionName, @Nonnull java.util.List<T> oldEnumValues, @Nullable java.util.List<T> newEnumValues, @Nullable java.util.function.BiFunction<java.lang.String,java.util.List<java.lang.String>,io.sphere.sdk.commands.UpdateAction<U>> removeEnumCallback, @Nullable TriFunction<java.lang.String,T,T,java.util.List<io.sphere.sdk.commands.UpdateAction<U>>> matchingEnumCallback, @Nullable java.util.function.BiFunction<java.lang.String,T,io.sphere.sdk.commands.UpdateAction<U>> addEnumCallback, @Nullable java.util.function.BiFunction<java.lang.String,java.util.List<T>,io.sphere.sdk.commands.UpdateAction<U>> changeOrderEnumCallback, @Nullable java.util.function.BiFunction<java.lang.String,java.util.List<java.lang.String>,io.sphere.sdk.commands.UpdateAction<U>> changeOrderWithKeysEnumCallback)
oldEnumValues
with a list of new newEnumValues
for a
given definition. The method serves as an implementation for enum values syncing. The method
takes in functions for building the required update actions (AddEnumValue, ChangeEnumValueOrder
and 1-1 update actions on enum values (e.g. changeLabel) for the required resource.T
- the enum type of the elements to change the order for.U
- the type of the resource in which the update actions will be applied on.definitionName
- the definition name whose enum values are going to be synced.oldEnumValues
- the old list of plain enum values.newEnumValues
- the new list of plain enum values.removeEnumCallback
- the function that is called in order to remove the new enum instance.matchingEnumCallback
- the function that is called to get the update action resulting from
comparing the enum value fields one by one.addEnumCallback
- the function that is called in order to add the new enum instance.changeOrderEnumCallback
- the function that is called to apply the change in the order.changeOrderWithKeysEnumCallback
- the function that is called to apply the change in the
order with keys.