java.lang.Object
io.helidon.builder.api.BuilderSupport
Static methods used from generated prototypes and builders.
This only contains methods that can be used without additional dependencies (i.e. ServiceLoader
based).
-
Method Summary
Modifier and TypeMethodDescriptionstatic <C> Optional
<C> discoverService
(Class<C> contract, boolean discoverServices, Optional<C> existingInstance) Discover a service fromServiceLoader
.static <C> List
<C> discoverServices
(Class<C> contract, boolean discoverServices, List<C> existingInstances) Discover services from JavaServiceLoader
.
-
Method Details
-
discoverServices
public static <C> List<C> discoverServices(Class<C> contract, boolean discoverServices, List<C> existingInstances) Discover services from JavaServiceLoader
. This method will only add instances of classes that are not already part ofexistingInstances
.- Type Parameters:
C
- type of the contract to use- Parameters:
contract
- service contract (or provider interface as used inServiceLoader
)discoverServices
- whether to discover services from service loader, if set to false, service loader is ignoredexistingInstances
- instances already configured on the builder- Returns:
- a list of new instances to add to the builder
-
discoverService
public static <C> Optional<C> discoverService(Class<C> contract, boolean discoverServices, Optional<C> existingInstance) Discover a service fromServiceLoader
. This method will only query the service loader if theexistingInstance
is empty.- Type Parameters:
C
- type of the contract- Parameters:
contract
- service contract (or provider interface as used inServiceLoader
)discoverServices
- whether to discover services from service loader, if set to false, service loader is ignoredexistingInstance
- an instance configured on the builder- Returns:
- value to be used by the builder (either the existing instance, an instance from
ServiceLoader
, or empty if none found
-