Top Description Constructors Methods
org.springframework.util.function

public abstract Class SupplierUtils

extends Object
Class Inheritance
Imports
java.util.function.Supplier, org.springframework.lang.Nullable

Convenience utilities for java.util.function.Supplier handling.
Author
Juergen Hoeller
Since
5.1
See Also
SingletonSupplier

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static <T> T

Returns:

the supplier's result, or null if none
resolve
(Supplier<T>
the supplier to resolve
supplier
)

Resolve the given Supplier, getting its result or immediately returning null if the supplier itself was null.

public static Object

Returns:

a supplier's result or the given Object as-is
resolve
(Object
the candidate to resolve (potentially a Supplier)
candidate
)

Resolve a given Supplier, getting its result or immediately returning the given Object as-is if not a Supplier.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

SupplierUtilsback to summary
public SupplierUtils()

Method Detail

resolveback to summary
public static <T> T resolve(Supplier<T> supplier)

Resolve the given Supplier, getting its result or immediately returning null if the supplier itself was null.

Parameters
supplier:Supplier<T>

the supplier to resolve

Returns:T

the supplier's result, or null if none

Annotations
@Nullable
resolveback to summary
public static Object resolve(Object candidate)

Resolve a given Supplier, getting its result or immediately returning the given Object as-is if not a Supplier.

Parameters
candidate:Object

the candidate to resolve (potentially a Supplier)

Returns:Object

a supplier's result or the given Object as-is

Annotations
@Nullable
Since
6.1.4