Interface ServiceDependenciesSpec
-
public interface ServiceDependenciesSpec
Allows declaring which services depend on which services.- Since:
- 1.3
- See Also:
ServiceDependencies
,DependsOn
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default ServiceDependenciesSpec
dependsOn(java.lang.Class<?> dependents, java.lang.Class<?> dependencies)
A convenience form ofdependsOn(Predicate, Predicate)
where the predicates are based on compatibility with the given types.default <T1,T2>
ServiceDependenciesSpecdependsOn(java.lang.Class<T1> dependentsType, ratpack.func.Predicate<? super T1> dependents, java.lang.Class<T2> dependenciesType, ratpack.func.Predicate<? super T2> dependencies)
Specifies that all services that are of the givendependentsType
that match thedependents
predicate are dependent on all services that are of thedependenciesType
that match thedependencies
predicate.ServiceDependenciesSpec
dependsOn(ratpack.func.Predicate<? super Service> dependents, ratpack.func.Predicate<? super Service> dependencies)
Specifies that all services that match thedependents
predicate are dependent on all services that match thedependencies
predicate.
-
-
-
Method Detail
-
dependsOn
ServiceDependenciesSpec dependsOn(ratpack.func.Predicate<? super Service> dependents, ratpack.func.Predicate<? super Service> dependencies) throws java.lang.Exception
Specifies that all services that match thedependents
predicate are dependent on all services that match thedependencies
predicate.Note that legacy
Service
will be wrapped in aLegacyServiceAdapter
when supplied to the given predicates.- Parameters:
dependents
- the criteria for dependent servicesdependencies
- the criteria for services they depend on- Returns:
this
- Throws:
java.lang.Exception
- any thrown by either predicate
-
dependsOn
default <T1,T2> ServiceDependenciesSpec dependsOn(java.lang.Class<T1> dependentsType, ratpack.func.Predicate<? super T1> dependents, java.lang.Class<T2> dependenciesType, ratpack.func.Predicate<? super T2> dependencies) throws java.lang.Exception
Specifies that all services that are of the givendependentsType
that match thedependents
predicate are dependent on all services that are of thedependenciesType
that match thedependencies
predicate.Note that this method is
LegacyServiceAdapter
aware. Adapted services are unpacked, and their real type (i.e.Service
implementation type) is used.- Type Parameters:
T1
- the type of dependent servicesT2
- the type of services they depend on- Parameters:
dependents
- the criteria for dependent servicesdependencies
- the criteria for services they depend on- Returns:
this
- Throws:
java.lang.Exception
- any thrown by either predicate
-
dependsOn
default ServiceDependenciesSpec dependsOn(java.lang.Class<?> dependents, java.lang.Class<?> dependencies) throws java.lang.Exception
A convenience form ofdependsOn(Predicate, Predicate)
where the predicates are based on compatibility with the given types.All services that are type compatible with the
dependents
type, will be considered dependents of all services that are type compatible with thedependencies
type.Note that this method is
LegacyServiceAdapter
aware. Adapted services are unpacked, and their real type (i.e.Service
implementation type) is used.Use of this method is equivalent to annotating
dependents
withDependsOn
with a value ofdependencies
. It can be useful in situations however where you are unable to modify thedependents
class.- Parameters:
dependents
- the type of dependent servicesdependencies
- the type of the services they depend on- Returns:
this
- Throws:
java.lang.Exception
- any- See Also:
DependsOn
-
-