Package io.micronaut.core.io.service
Interface ServiceDefinition<T>
- Type Parameters:
T
- The service type
- All Known Implementing Classes:
SoftServiceLoader.StaticDefinition
public interface ServiceDefinition<T>
A service that may or may not be present on the classpath.
-
Method Summary
-
Method Details
-
getName
String getName()- Returns:
- The full class name of the service
-
isPresent
default boolean isPresent()- Returns:
- is the service present
-
orElseThrow
Load the service of throw the given exception.- Type Parameters:
X
- The exception type- Parameters:
exceptionSupplier
- The exception supplier- Returns:
- The instance
- Throws:
X
- The exception concrete type
-
load
T load()- Returns:
- load the service
-