Package org.wildfly.service
Interface ServiceDependency<V>
- All Superinterfaces:
Consumer<ServiceBuilder<?>>,Dependency<ServiceBuilder<?>,,V> Supplier<V>
- All Known Implementing Classes:
ServiceDependency.DefaultServiceDependency,ServiceDependency.SimpleServiceDependency,ServiceDependency.SuppliedServiceDependency
Encapsulates a dependency on a service value.
- Author:
- Paul Ferraro
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classstatic classstatic classNested classes/interfaces inherited from interface org.wildfly.service.Dependency
Dependency.AbstractDependency<B extends ServiceBuilder<?>,V>, Dependency.DefaultDependency<B extends ServiceBuilder<?>, V>, Dependency.SimpleDependency<B extends ServiceBuilder<?>, V>, Dependency.SuppliedDependency<B extends ServiceBuilder<?>, V> -
Method Summary
Modifier and TypeMethodDescriptiondefault ServiceDependency<V>andThen(Consumer<? super ServiceBuilder<?>> after) default <T,R> ServiceDependency<R> combine(Dependency<ServiceBuilder<?>, T> dependency, BiFunction<V, T, R> mapper) Returns a dependency that combines this dependency with the specified dependency, whose value is determined by the specified mapping function.static <V> ServiceDependency<V>empty()Returns an empty pseudo-dependency whoseSupplier.get()returns null.static <V> ServiceDependency<V>Returns a pseudo-dependency whoseSupplier.get()returns the value from the specified supplier.default <R> ServiceDependency<R>Returns a dependency whose value is the result of applying the specified mapping function.static <V> ServiceDependency<V>of(V value) Returns a pseudo-dependency whoseSupplier.get()returns the specified value.static <V> ServiceDependency<V>on(ServiceName name) Returns a dependency on the service with the specified name.Methods inherited from interface org.wildfly.service.Dependency
isEmpty, isPresent
-
Method Details
-
andThen
- Specified by:
andThenin interfaceConsumer<V>- Specified by:
andThenin interfaceDependency<ServiceBuilder<?>,V>
-
map
Description copied from interface:DependencyReturns a dependency whose value is the result of applying the specified mapping function.- Specified by:
mapin interfaceDependency<ServiceBuilder<?>,V> - Type Parameters:
R- the mapped value type- Parameters:
mapper- a mapping function- Returns:
- a dependency whose value is the result of applying the specified mapping function.
-
combine
default <T,R> ServiceDependency<R> combine(Dependency<ServiceBuilder<?>, T> dependency, BiFunction<V, T, R> mapper) Description copied from interface:DependencyReturns a dependency that combines this dependency with the specified dependency, whose value is determined by the specified mapping function.- Specified by:
combinein interfaceDependency<ServiceBuilder<?>,V> - Type Parameters:
T- the other dependency typeR- the mapped value type- Parameters:
dependency- another dependencymapper- a mapping function- Returns:
- a dependency that combines this dependency with the specified dependency, whose value is determined by the specified mapping function.
-
empty
Returns an empty pseudo-dependency whoseSupplier.get()returns null.- Type Parameters:
V- the value type- Returns:
- an empty service dependency
-
of
Returns a pseudo-dependency whoseSupplier.get()returns the specified value.- Type Parameters:
V- the value type- Parameters:
value- a service value- Returns:
- a pseudo-dependency whose
Supplier.get()returns the specified value.
-
from
Returns a pseudo-dependency whoseSupplier.get()returns the value from the specified supplier.- Type Parameters:
V- the value type- Parameters:
supplier- a service value supplier- Returns:
- a pseudo-dependency whose
Supplier.get()returns the value from the specified supplier. - Throws:
NullPointerException- ifsupplierwas null
-
on
Returns a dependency on the service with the specified name.- Type Parameters:
V- the dependency type- Parameters:
name- a service name- Returns:
- a service dependency
-