Class PropertyUtils

java.lang.Object
org.aksw.commons.beans.model.PropertyUtils

public class PropertyUtils extends Object
Utility methods for applying defaults to properties
Author:
Claus Stadler
  • 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)
    • applyIfAbsent

      public static <T> T applyIfAbsent(Consumer<? super T> targetSetter, Supplier<? extends T> targetGetter, Supplier<? extends T> valueGetter)
      If targetGetter yields null, invoke the targetSetter with the valueGetter's result.
      Parameters:
      targetSetter -
      targetGetter -
      valueGetter -
      Returns:
    • applyIfAbsent

      public static <T> T applyIfAbsent(Function<? super T,?> targetSetter, Supplier<? extends T> targetGetter, Supplier<? extends T> valueGetter)
      If targetGetter yields null, invoke the targetSetter with the valueGetter's result.
      Parameters:
      targetSetter -
      targetGetter -
      valueGetter -
      Returns: