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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final record -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final @NonNull ServiceRegistrationsBinding<S> The field for thebindingrecord component.The field for thedelegateSupplierrecord component.The field for theserviceTyperecord component. -
Constructor Summary
ConstructorsConstructorDescriptionProxiedServiceRegistration(@NonNull Class<S> serviceType, @NonNull ServiceRegistrationsBinding<S> binding, @NonNull Supplier<eu.cloudnetservice.driver.registry.ServiceRegistryRegistration<S>> delegateSupplier) Creates an instance of aProxiedServiceRegistrationrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbinding()Returns the value of thebindingrecord component.booleanReturns the value of thedelegateSupplierrecord component.final booleanIndicates whether some other object is "equal to" this one.get()final inthashCode()Returns a hash code value for this object.voidname()Returns the value of theserviceTyperecord component.final StringtoString()Returns a string representation of this record class.booleanbooleanvalid()
-
Field Details
-
serviceType
The field for theserviceTyperecord component. -
binding
The field for thebindingrecord component. -
delegateSupplier
@NonNull private final @NonNull Supplier<eu.cloudnetservice.driver.registry.ServiceRegistryRegistration<S>> delegateSupplierThe field for thedelegateSupplierrecord component.
-
-
Constructor Details
-
ProxiedServiceRegistration
ProxiedServiceRegistration(@NonNull @NonNull Class<S> serviceType, @NonNull @NonNull ServiceRegistrationsBinding<S> binding, @NonNull @NonNull Supplier<eu.cloudnetservice.driver.registry.ServiceRegistryRegistration<S>> delegateSupplier) Creates an instance of aProxiedServiceRegistrationrecord class.- Parameters:
serviceType- the value for theserviceTyperecord componentbinding- the value for thebindingrecord componentdelegateSupplier- the value for thedelegateSupplierrecord component
-
-
Method Details
-
name
-
serviceInstance
-
defaultService
public boolean defaultService()- Specified by:
defaultServicein interfaceeu.cloudnetservice.driver.registry.ServiceRegistryRegistration<S>
-
markAsDefaultService
public void markAsDefaultService()- Specified by:
markAsDefaultServicein interfaceeu.cloudnetservice.driver.registry.ServiceRegistryRegistration<S>
-
valid
public boolean valid()- Specified by:
validin interfaceeu.cloudnetservice.driver.registry.ServiceRegistryRegistration<S>
-
unregister
public boolean unregister()- Specified by:
unregisterin interfaceeu.cloudnetservice.driver.registry.ServiceRegistryRegistration<S>
-
get
-
toString
-
hashCode
-
equals
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 withObjects::equals(Object,Object). -
serviceType
Returns the value of theserviceTyperecord component.- Specified by:
serviceTypein interfaceeu.cloudnetservice.driver.registry.ServiceRegistryRegistration<S>- Returns:
- the value of the
serviceTyperecord component
-
binding
-
delegateSupplier
@NonNull public @NonNull Supplier<eu.cloudnetservice.driver.registry.ServiceRegistryRegistration<S>> delegateSupplier()Returns the value of thedelegateSupplierrecord component.- Returns:
- the value of the
delegateSupplierrecord component
-