Interface ServiceDescriptor<T>

Type Parameters:
T - type of the described service
All Superinterfaces:
Comparable<Weighted>, ServiceInfo, Weighted
All Known Implementing Classes:
ExistingInstanceDescriptor, VirtualDescriptor

public interface ServiceDescriptor<T> extends ServiceInfo
A descriptor of a service. In addition to providing service metadata, this also allows instantiation of the service instance, with dependent services as parameters.
  • Method Details

    • instantiate

      default Object instantiate(DependencyContext ctx, InterceptionMetadata interceptionMetadata)
      Create a new service instance.
      Parameters:
      ctx - dependency context with all dependencies of this service
      interceptionMetadata - metadata handler for interception
      Returns:
      a new instance, must be of the type T or a subclass
    • inject

      default void inject(DependencyContext ctx, InterceptionMetadata interceptionMetadata, Set<String> injected, T instance)
      Inject fields and methods.
      Parameters:
      ctx - injection context
      interceptionMetadata - interception metadata to support interception of field injection
      injected - mutable set of already injected methods from subtypes
      instance - instance to update
    • postConstruct

      default void postConstruct(T instance)
      Invoke Service.PostConstruct annotated method(s).
      Parameters:
      instance - instance to use
    • preDestroy

      default void preDestroy(T instance)
      Invoke Service.PreDestroy annotated method(s).
      Parameters:
      instance - instance to use
    • scope

      default TypeName scope()
      Scope of this service.
      Specified by:
      scope in interface ServiceInfo
      Returns:
      scope of the service