public interface IfSetter<S,T>
should Partial/Conditional set property from Source(of) to Target(to) - null/nonnull is nullability - invalid/valid is business validation
| Modifier and Type | Interface and Description |
|---|---|
static class |
IfSetter.Absent |
static class |
IfSetter.Present |
| Modifier and Type | Method and Description |
|---|---|
static <T> void |
invalid(@NotNull Consumer<T> setter,
T value,
boolean valid)
should set if not valid
|
static <T> void |
invalid(@NotNull Consumer<T> setter,
T value,
@NotNull Predicate<T> validate)
should set if validated value is not valid
|
static <T> void |
nonnull(@NotNull Consumer<T> setter,
T value)
should set if value is not null
|
default T |
ofNonnull(T target,
S source)
should set non-null source's props to target
|
default T |
ofValid(T target,
S source)
should set valid source's props to target
|
T |
set(T target,
S source,
@NotNull IfSetter.Absent to,
@NotNull IfSetter.Present of)
should set source's props to target on target absent and source present.
|
default T |
toAny(T target,
S source)
should set any source's props to target
|
default T |
toInvalid(T target,
S source)
should set source's props to target if target's is invalid
|
default T |
toNull(T target,
S source)
should set source's props to target if target's is null
|
static <T> void |
valid(@NotNull Consumer<T> setter,
T value,
boolean valid)
should set if valid
|
static <T> void |
valid(@NotNull Consumer<T> setter,
T value,
@NotNull Predicate<T> validate)
should set if validated value is valid
|
@Contract(value="_,_,_,_->param1") T set(@NotNull T target, @Nullable S source, @NotNull @NotNull IfSetter.Absent to, @NotNull @NotNull IfSetter.Present of)
@Contract(value="_,_->param1") default T toAny(@NotNull T target, @Nullable S source)
@Contract(value="_,_->param1") default T toNull(@NotNull T target, @Nullable S source)
@Contract(value="_,_->param1") default T toInvalid(@NotNull T target, @Nullable S source)
@Contract(value="_,_->param1") default T ofNonnull(@NotNull T target, @Nullable S source)
@Contract(value="_,_->param1") default T ofValid(@NotNull T target, @Nullable S source)
static <T> void nonnull(@NotNull
@NotNull Consumer<T> setter,
@Nullable
T value)
static <T> void valid(@NotNull
@NotNull Consumer<T> setter,
@Nullable
T value,
boolean valid)
static <T> void valid(@NotNull
@NotNull Consumer<T> setter,
@Nullable
T value,
@NotNull
@NotNull Predicate<T> validate)
static <T> void invalid(@NotNull
@NotNull Consumer<T> setter,
@Nullable
T value,
boolean valid)
Copyright © 2024. All rights reserved.