Package org.wildfly.service
Interface Dependency<B extends ServiceBuilder<?>,V>
- All Known Subinterfaces:
ServiceDependency<V>,ServiceDependency<V>
- All Known Implementing Classes:
Dependency.AbstractDependency,Dependency.DefaultDependency,Dependency.SimpleDependency,Dependency.SuppliedDependency,ServiceDependency.AbstractServiceDependency,ServiceDependency.DefaultServiceDependency,ServiceDependency.DefaultServiceDependency,ServiceDependency.SimpleServiceDependency,ServiceDependency.SimpleServiceDependency,ServiceDependency.SuppliedServiceDependency,ServiceDependency.SuppliedServiceDependency
Encapsulates logic for registering a value providing dependency with a service builder.
- Author:
- Paul Ferraro
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classDependency.AbstractDependency<B extends ServiceBuilder<?>,V> static classDependency.DefaultDependency<B extends ServiceBuilder<?>,V> static classDependency.SimpleDependency<B extends ServiceBuilder<?>,V> static classDependency.SuppliedDependency<B extends ServiceBuilder<?>,V> -
Method Summary
Modifier and TypeMethodDescriptiondefault Dependency<B,V> default <T,R> Dependency<B, R> combine(Dependency<B, 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.default booleanisEmpty()Indicates whether this dependency will never provide a value.default booleanIndicates whether this dependency will provide a value.default <R> Dependency<B,R> Returns a dependency whose value is the result of applying the specified mapping function.
-
Method Details
-
andThen
- Specified by:
andThenin interfaceConsumer<B extends ServiceBuilder<?>>
-
map
Returns a dependency whose value is the result of applying the specified mapping function.- 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.
- Throws:
NullPointerException- ifmapperwas null
-
combine
Returns a dependency that combines this dependency with the specified dependency, whose value is determined by the specified mapping function.- 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.
- Throws:
NullPointerException- ifdependencyormapperwere null.
-
isEmpty
default boolean isEmpty()Indicates whether this dependency will never provide a value.- Returns:
- true, if this dependency will not provide a value, false otherwise.
-
isPresent
default boolean isPresent()Indicates whether this dependency will provide a value. This method is the direct inverse ofisEmpty().- Returns:
- true, if this dependency will provide a value, false otherwise.
-