Interface ServiceRegistryRegistration<S>

Type Parameters:
S - the type of the service.
All Superinterfaces:
Named, jakarta.inject.Provider<S>

public interface ServiceRegistryRegistration<S> extends jakarta.inject.Provider<S>, Named
A registration for a service in a service registration.
Since:
4.0
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Get if this registration is the default registration for the service.
    void
    Marks this registration as the default for the service type.
    Get an instance of the service implementation represented by this registration.
    Get the service type that this registration is associated with.
    boolean
    Unregisters this registration.
    boolean
    Get if this registration is still valid, which means that this registration was not unregistered yet.

    Methods inherited from interface Named

    name

    Methods inherited from interface jakarta.inject.Provider

    get
  • Method Details

    • serviceType

      @NonNull @NonNull Class<S> serviceType()
      Get the service type that this registration is associated with.
      Returns:
      the service type.
    • serviceInstance

      @NonNull S serviceInstance()
      Get an instance of the service implementation represented by this registration.
      Returns:
      an instance of the service registration represented by this registration.
    • defaultService

      boolean defaultService()
      Get if this registration is the default registration for the service.
      Returns:
      true if this registration is the default for the service, false otherwise.
    • markAsDefaultService

      void markAsDefaultService()
      Marks this registration as the default for the service type.
      Throws:
      IllegalStateException - if this registration is no longer valid.
    • valid

      boolean valid()
      Get if this registration is still valid, which means that this registration was not unregistered yet.
      Returns:
      true if this registration is still valid, false otherwise.
    • unregister

      boolean unregister()
      Unregisters this registration.
      Returns:
      true if this registration was unregistered, false otherwise.