Package org.apereo.cas.util.spring.beans
Interface BeanSupplier<T>
-
- All Superinterfaces:
java.util.function.Supplier<T>
- All Known Implementing Classes:
BeanSupplier.DefaultBeanSupplier
public interface BeanSupplier<T> extends java.util.function.Supplier<T>This isBeanSupplier.- Since:
- 6.5.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classBeanSupplier.DefaultBeanSupplier<T>static classBeanSupplier.ProxiedBeanSupplier<T>
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringPROXY_BEAN_TOSTRING_PREFIXToString() prefix.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default BeanSupplier<T>alwaysMatch()Always true condition.default BeanSupplier<T>and(java.util.function.Supplier<java.lang.Boolean> conditionSupplier)Combine conditions together.Tget()default BeanSupplier<T>ifExists(java.lang.String resource)Add condition to ensure given resource exist.static booleanisNotProxy(java.lang.Object result)Is not proxy class?static booleanisProxy(java.lang.Object result)Is proxy class?default BeanSupplier<T>neverMatch()Always false condition.static <T> BeanSupplier<T>of(java.lang.Class<T> clazz)Create bean supplier for type.BeanSupplier<T>otherwise(java.util.function.Supplier<T> beanSupplier)Create the proxy bean via a given supplier when the condition fails.BeanSupplier<T>otherwiseProxy()Create the proxy bean via a given supplier when the condition fails.BeanSupplier<T>supply(java.util.function.Supplier<T> beanSupplier)Create the bean via a given supplier when condition passes.default BeanSupplier<T>when(boolean rawValue)Specify condition for bean supplier to create beans.BeanSupplier<T>when(java.util.function.Supplier<java.lang.Boolean> conditionSupplier)Specify condition for bean supplier to create beans.
-
-
-
Field Detail
-
PROXY_BEAN_TOSTRING_PREFIX
static final java.lang.String PROXY_BEAN_TOSTRING_PREFIX
ToString() prefix.- See Also:
- Constant Field Values
-
-
Method Detail
-
of
static <T> BeanSupplier<T> of(java.lang.Class<T> clazz)
Create bean supplier for type.- Type Parameters:
T- the type parameter- Parameters:
clazz- the clazz- Returns:
- the bean supplier
-
isProxy
static boolean isProxy(java.lang.Object result)
Is proxy class?- Parameters:
result- the result- Returns:
- the boolean
-
isNotProxy
static boolean isNotProxy(java.lang.Object result)
Is not proxy class?- Parameters:
result- the result- Returns:
- the boolean
-
alwaysMatch
default BeanSupplier<T> alwaysMatch()
Always true condition.- Returns:
- the bean supplier
-
neverMatch
default BeanSupplier<T> neverMatch()
Always false condition.- Returns:
- the bean supplier
-
when
BeanSupplier<T> when(java.util.function.Supplier<java.lang.Boolean> conditionSupplier)
Specify condition for bean supplier to create beans.- Parameters:
conditionSupplier- the condition supplier- Returns:
- the bean supplier
-
when
default BeanSupplier<T> when(boolean rawValue)
Specify condition for bean supplier to create beans.- Parameters:
rawValue- the raw value- Returns:
- the bean supplier
-
ifExists
default BeanSupplier<T> ifExists(java.lang.String resource)
Add condition to ensure given resource exist.- Parameters:
resource- the resource- Returns:
- the bean supplier
-
and
default BeanSupplier<T> and(java.util.function.Supplier<java.lang.Boolean> conditionSupplier)
Combine conditions together.- Parameters:
conditionSupplier- the condition supplier- Returns:
- the bean supplier
-
supply
BeanSupplier<T> supply(java.util.function.Supplier<T> beanSupplier)
Create the bean via a given supplier when condition passes.- Parameters:
beanSupplier- the bean supplier- Returns:
- the bean supplier
-
otherwise
BeanSupplier<T> otherwise(java.util.function.Supplier<T> beanSupplier)
Create the proxy bean via a given supplier when the condition fails.- Parameters:
beanSupplier- the bean supplier- Returns:
- the bean supplier
-
otherwiseProxy
BeanSupplier<T> otherwiseProxy()
Create the proxy bean via a given supplier when the condition fails.- Returns:
- the bean supplier
-
-