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 Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static Object
    resolve(Object candidate)
    Resolve a given Supplier, getting its result or immediately returning the given Object as-is if not a Supplier.
    static <T> T
    resolve(Supplier<T> supplier)
    Resolve the given Supplier, getting its result or immediately returning null if the supplier itself was null.

    Methods inherited from class java.lang.Object

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

    • SupplierUtils

      public SupplierUtils()
  • Method Details

    • resolve

      @Nullable public static <T> 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

      @Nullable public static 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