Class Singleton<R>
java.lang.Object
com.ulisesbocchio.jasyptspringboot.util.Singleton<R>
- All Implemented Interfaces:
Supplier<R>
Singleton initializer class that uses an internal supplier to supply the singleton instance. The supplier
originally checks whether the instanceSupplier
has been initialized or not, but after initialization the instance supplier is changed to avoid extra logic
execution.
- Version:
- $Id: $Id
- Author:
- Sergio.U.Bocchio
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T,U, R> Singleton<R> from(BiFunction<T, U, R> original, T arg0, U arg1) from.static <T,R> Singleton<R> from.static <R> Singleton<R>from.static <T,U, R> Singleton<R> fromLazy(BiFunction<T, U, R> original, Supplier<T> arg0Supplier, Supplier<U> arg1Supplier) fromLazy.static <T,R> Singleton<R> fromLazy.get()
-
Constructor Details
-
Singleton
Constructor for Singleton.
- Parameters:
original- aSupplierobject
-
-
Method Details
-
from
from.
-
from
from.
-
from
from.
- Type Parameters:
T- a T classU- a U classR- a R class- Parameters:
original- aBiFunctionobjectarg0- a T objectarg1- a U object- Returns:
- a
Singletonobject
-
fromLazy
fromLazy.
-
fromLazy
public static <T,U, Singleton<R> fromLazyR> (BiFunction<T, U, R> original, Supplier<T> arg0Supplier, Supplier<U> arg1Supplier) fromLazy.
- Type Parameters:
T- a T classU- a U classR- a R class- Parameters:
original- aBiFunctionobjectarg0Supplier- aSupplierobjectarg1Supplier- aSupplierobject- Returns:
- a
Singletonobject
-
get
-