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 Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T> T
    apply(boolean setNull, org.aksw.commons.lambda.throwing.ThrowingConsumer<? super T> setter, org.aksw.commons.lambda.throwing.ThrowingSupplier<? extends T> getter)
     
    static <T> T
    apply(boolean setNull, org.aksw.commons.lambda.throwing.ThrowingFunction<? super T,?> setter, org.aksw.commons.lambda.throwing.ThrowingSupplier<? extends T> getter)
     
    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.
    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.
    static <T> T
    applyIfPresent(org.aksw.commons.lambda.throwing.ThrowingConsumer<? super T> setter, org.aksw.commons.lambda.throwing.ThrowingSupplier<? extends T> getter)
    Invoke the setter with the getter's value - unless the getter returns null.
    static <T> T
    applyIfPresent(org.aksw.commons.lambda.throwing.ThrowingFunction<? super T,?> setter, org.aksw.commons.lambda.throwing.ThrowingSupplier<? extends T> getter)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • PropertyUtils

      public PropertyUtils()
  • Method Details

    • applyIfPresent

      public static <T> T applyIfPresent(org.aksw.commons.lambda.throwing.ThrowingConsumer<? super T> setter, org.aksw.commons.lambda.throwing.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(org.aksw.commons.lambda.throwing.ThrowingFunction<? super T,?> setter, org.aksw.commons.lambda.throwing.ThrowingSupplier<? extends T> getter)
    • apply

      public static <T> T apply(boolean setNull, org.aksw.commons.lambda.throwing.ThrowingConsumer<? super T> setter, org.aksw.commons.lambda.throwing.ThrowingSupplier<? extends T> getter)
    • apply

      public static <T> T apply(boolean setNull, org.aksw.commons.lambda.throwing.ThrowingFunction<? super T,?> setter, org.aksw.commons.lambda.throwing.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: