Class SupplierUtils

java.lang.Object
org.springframework.util.function.SupplierUtils

public abstract class SupplierUtils extends Object
Convenience utilities for Supplier handling.
Since:
5.1
Author:
Juergen Hoeller
See Also:
  • Constructor Details

    • SupplierUtils

      public SupplierUtils()
  • Method Details

    • resolve

      @Contract("null -> null; !null -> !null") public static <T> @Nullable T resolve(@Nullable Supplier<T> supplier)
      Resolve the given Supplier, getting its result or immediately returning null if the supplier itself was null.
      Parameters:
      supplier - the supplier to resolve
      Returns:
      the supplier's result, or null if none
    • resolve

      public static @Nullable Object resolve(@Nullable Object candidate)
      Resolve a given Supplier, getting its result or immediately returning the given Object as-is if not a Supplier.
      Parameters:
      candidate - the candidate to resolve (potentially a Supplier)
      Returns:
      a supplier's result or the given Object as-is
      Since:
      6.1.4