Record Class ProxiedServiceRegistration<S>

java.lang.Object
java.lang.Record
eu.cloudnetservice.driver.impl.registry.ProxiedServiceRegistration<S>
Type Parameters:
S - the type modeling the implemented service.
Record Components:
serviceType - the type of the service that is implemented by this registration.
binding - the binding in which this registration is registered.
delegateSupplier - the supplier to get the service registration to which this registration delegates.
All Implemented Interfaces:
eu.cloudnetservice.driver.base.Named, eu.cloudnetservice.driver.registry.ServiceRegistryRegistration<S>, jakarta.inject.Provider<S>

record ProxiedServiceRegistration<S>(@NonNull Class<S> serviceType, @NonNull ServiceRegistrationsBinding<S> binding, @NonNull Supplier<eu.cloudnetservice.driver.registry.ServiceRegistryRegistration<S>> delegateSupplier) extends Record implements eu.cloudnetservice.driver.registry.ServiceRegistryRegistration<S>
A service registration that is just a proxy to another service registration and returns a proxy to that service instance when the instance is retrieved. This way, for example, the default service registration can be updated without having to get the default instance every time as the proxy just always delegates to the current default registration.
Since:
4.0
  • Field Details

  • Constructor Details

  • Method Details

    • name

      @NonNull public @NonNull String name()
      Specified by:
      name in interface eu.cloudnetservice.driver.base.Named
    • serviceInstance

      @NonNull public S serviceInstance()
      Specified by:
      serviceInstance in interface eu.cloudnetservice.driver.registry.ServiceRegistryRegistration<S>
    • defaultService

      public boolean defaultService()
      Specified by:
      defaultService in interface eu.cloudnetservice.driver.registry.ServiceRegistryRegistration<S>
    • markAsDefaultService

      public void markAsDefaultService()
      Specified by:
      markAsDefaultService in interface eu.cloudnetservice.driver.registry.ServiceRegistryRegistration<S>
    • valid

      public boolean valid()
      Specified by:
      valid in interface eu.cloudnetservice.driver.registry.ServiceRegistryRegistration<S>
    • unregister

      public boolean unregister()
      Specified by:
      unregister in interface eu.cloudnetservice.driver.registry.ServiceRegistryRegistration<S>
    • get

      @NonNull public S get()
      Specified by:
      get in interface jakarta.inject.Provider<S>
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • serviceType

      @NonNull public @NonNull Class<S> serviceType()
      Returns the value of the serviceType record component.
      Specified by:
      serviceType in interface eu.cloudnetservice.driver.registry.ServiceRegistryRegistration<S>
      Returns:
      the value of the serviceType record component
    • binding

      Returns the value of the binding record component.
      Returns:
      the value of the binding record component
    • delegateSupplier

      @NonNull public @NonNull Supplier<eu.cloudnetservice.driver.registry.ServiceRegistryRegistration<S>> delegateSupplier()
      Returns the value of the delegateSupplier record component.
      Returns:
      the value of the delegateSupplier record component