Record Class FixedInstanceServiceRegistration<S>

java.lang.Object
java.lang.Record
eu.cloudnetservice.driver.impl.registry.FixedInstanceServiceRegistration<S>
Type Parameters:
S - the type modeling the implemented service.
Record Components:
serviceType - the type of the service that is implemented by this registration.
serviceName - the name of the service registration.
serviceInstance - the instance that is mapped in this registration.
binding - the binding in which this registration is registered.
All Implemented Interfaces:
eu.cloudnetservice.driver.base.Named, eu.cloudnetservice.driver.registry.ServiceRegistryRegistration<S>, jakarta.inject.Provider<S>

record FixedInstanceServiceRegistration<S>(@NonNull Class<S> serviceType, @NonNull String serviceName, S serviceInstance, @NonNull ServiceRegistrationsBinding<S> binding) extends Record implements eu.cloudnetservice.driver.registry.ServiceRegistryRegistration<S>
A service registration that returns a single, fixed instance when retrieved.
Since:
4.0
  • Field Details

  • Constructor Details

  • Method Details

    • 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>
    • name

      @NonNull public @NonNull String name()
      Specified by:
      name in interface eu.cloudnetservice.driver.base.Named
    • 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
    • serviceName

      @NonNull public @NonNull String serviceName()
      Returns the value of the serviceName record component.
      Returns:
      the value of the serviceName record component
    • serviceInstance

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

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