Class PropertyUtils
java.lang.Object
org.aksw.commons.beans.model.PropertyUtils
Utility methods for applying defaults to properties
- Author:
- Claus Stadler
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Tapply(boolean setNull, ThrowingConsumer<? super T> setter, ThrowingSupplier<? extends T> getter) static <T> Tapply(boolean setNull, ThrowingFunction<? super T, ?> setter, ThrowingSupplier<? extends T> getter) static <T> TapplyIfAbsent(Consumer<? super T> targetSetter, Supplier<? extends T> targetGetter, Supplier<? extends T> valueGetter) If targetGetter yields null, invoke the targetSetter with the valueGetter's result.static <T> TapplyIfAbsent(Function<? super T, ?> targetSetter, Supplier<? extends T> targetGetter, Supplier<? extends T> valueGetter) If targetGetter yields null, invoke the targetSetter with the valueGetter's result.static <T> TapplyIfPresent(ThrowingConsumer<? super T> setter, ThrowingSupplier<? extends T> getter) Invoke the setter with the getter's value - unless the getter returns null.static <T> TapplyIfPresent(ThrowingFunction<? super T, ?> setter, ThrowingSupplier<? extends T> getter)
-
Constructor Details
-
PropertyUtils
public PropertyUtils()
-
-
Method Details
-
applyIfPresent
public static <T> T applyIfPresent(ThrowingConsumer<? super T> setter, ThrowingSupplier<? extends T> getter) Invoke the setter with the getter's value - unless the getter returns null.- Parameters:
setter-getter-- Returns:
-
applyIfPresent
public static <T> T applyIfPresent(ThrowingFunction<? super T, ?> setter, ThrowingSupplier<? extends T> getter) -
apply
public static <T> T apply(boolean setNull, ThrowingConsumer<? super T> setter, ThrowingSupplier<? extends T> getter) -
apply
public static <T> T apply(boolean setNull, ThrowingFunction<? super T, ?> setter, ThrowingSupplier<? extends T> getter) -
applyIfAbsent
-
applyIfAbsent
-