Class ServiceLoader__ServiceDescriptor
java.lang.Object
io.helidon.service.registry.ServiceLoader__ServiceDescriptor
- All Implemented Interfaces:
Weighted, ServiceDescriptor<Object>, ServiceInfo, Comparable<Weighted>
public abstract class ServiceLoader__ServiceDescriptor
extends Object
implements ServiceDescriptor<Object>
Service descriptor to enable dependency on services loaded via
ServiceLoader.-
Field Summary
Fields inherited from interface Weighted
DEFAULT_WEIGHTModifier and TypeFieldDescriptionstatic final doubleDefault weight for any weighted component (whether it implements this interface or usesWeightannotation). -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> ServiceDescriptor<Object> Create a new instance for a specific provider interface and implementation.static ServiceDescriptor<Object> create(TypeName providerInterface, ServiceLoader.Provider<Object> provider, double weight) Create a new instance for a specific service provider interface and its implementation.Type of the service descriptor (usually generated).abstract TypeNameType name of the provider interface this service implementation implements.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ServiceDescriptor
inject, instantiate, postConstruct, preDestroy, scope, typeSetModifier and TypeMethodDescriptiondefault voidinject(DependencyContext ctx, InterceptionMetadata interceptionMetadata, Set<String> injected, Object instance) Inject fields and methods.default Objectinstantiate(DependencyContext ctx, InterceptionMetadata interceptionMetadata) Create a new service instance.default voidpostConstruct(Object instance) InvokeService.PostConstructannotated method(s).default voidpreDestroy(Object instance) InvokeService.PreDestroyannotated method(s).default TypeNamescope()Scope of this service.default Set<ResolvedType> typeSet(ResolvedType contract) Provide a mapping of a contracts of this service to its contract type set.Methods inherited from interface ServiceInfo
contracts, dependencies, factoryContracts, factoryType, isAbstract, providedType, qualifiers, runLevel, serviceTypeModifier and TypeMethodDescriptiondefault Set<ResolvedType> Set of contracts the described service implements or provides through a factory method.default List<Dependency> List of dependencies required by this service.default Set<ResolvedType> Set of contracts that identify the factory provider itself.default FactoryTypeWhat factory type is the described service.default booleanReturnstruefor abstract classes and interfaces, returnsfalseby default.default TypeNameThe type that implementsServiceInfo.contracts().Service qualifiers.runLevel()Run level of this service.Type of the service this descriptor describes.
-
Method Details
-
create
public static ServiceDescriptor<Object> create(TypeName providerInterface, ServiceLoader.Provider<Object> provider, double weight) Create a new instance for a specific service provider interface and its implementation.- Parameters:
providerInterface- provider interface typeprovider- Java Service Loader provider instanceweight- weight of the provider- Returns:
- new descriptor
-
create
public static <T> ServiceDescriptor<Object> create(TypeName providerInterface, Class<T> implType, Supplier<T> instanceSupplier, double weight) Create a new instance for a specific provider interface and implementation. This method is used from generated code.- Type Parameters:
T- type of the implementation- Parameters:
providerInterface- provider interface typeimplType- implementation classinstanceSupplier- supplier of a new instance (so we do not use reflection)weight- weight of the provider implementation- Returns:
- a new service descriptor
-
descriptorType
Description copied from interface:ServiceInfoType of the service descriptor (usually generated).- Specified by:
descriptorTypein interfaceServiceInfo- Returns:
- descriptor type
-
providerInterface
Type name of the provider interface this service implementation implements.- Returns:
- provider interface type
-