Package io.hekate.core.service
Interface DependencyContext
-
public interface DependencyContext
Context forDependentService
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Hekate
hekate()
Returns theHekate
instance that manages this service.io.micrometer.core.instrument.MeterRegistry
metrics()
Returns metrics registry.String
nodeName()
Returns the node node.<T extends Service>
Toptional(Class<T> service)
Returns a reference to an optional service.<T extends Service>
Trequire(Class<T> service)
Returns a reference to a required service.
-
-
-
Method Detail
-
nodeName
String nodeName()
Returns the node node.- Returns:
- Name of this node.
- See Also:
HekateBootstrap.setNodeName(String)
-
hekate
Hekate hekate()
Returns theHekate
instance that manages this service.Notice: the returned instance may be not fully initialized. The main purpose of this method is to provide a reference for the service back to its owning
Hekate
instance, so that it could be used during the further lifecycle phases.- Returns:
Hekate
instance that manages this service.
-
require
<T extends Service> T require(Class<T> service) throws ServiceDependencyException
Returns a reference to a required service. If such service can't be found thenServiceDependencyException
will be thrown.- Type Parameters:
T
- Service type.- Parameters:
service
- Service type.- Returns:
- Service.
- Throws:
ServiceDependencyException
- If required service couldn't be found.
-
optional
<T extends Service> T optional(Class<T> service)
Returns a reference to an optional service. If there is no such service then this method returnsnull
.- Type Parameters:
T
- Service type.- Parameters:
service
- Service type.- Returns:
- Service or
null
if the is no such service.
-
metrics
io.micrometer.core.instrument.MeterRegistry metrics()
Returns metrics registry.- Returns:
- Metrics registry.
-
-