created api to update the call

This commit is contained in:
rajesh
2024-08-27 11:30:32 +05:30
parent c55ca10d03
commit f561695db0
22 changed files with 458 additions and 285 deletions

View File

@@ -10,6 +10,8 @@ import org.slf4j.LoggerFactory;
import java.nio.charset.StandardCharsets;
import java.util.Base64;
import java.util.List;
import java.util.function.Consumer;
import java.util.function.Supplier;
import java.util.stream.Collectors;
public class Utils {
@@ -68,5 +70,17 @@ public class Utils {
byte[] decode = Base64.getDecoder().decode(decodedString.getBytes(StandardCharsets.UTF_8));
return new String(decode, StandardCharsets.UTF_8);
}
public static <T> void setIfNotNull(Consumer<T> setter, T value) {
if (value != null) {
setter.accept(value);
}
}
public static <T> void setIfUpdated(Supplier<T> getter, Consumer<T> setter, T newValue) {
T currentValue = getter.get();
if (newValue != null && !newValue.equals(currentValue)) {
setter.accept(newValue);
}
}
}