Record Class NewInstanceServiceRegistration<S>
java.lang.Object
java.lang.Record
eu.cloudnetservice.driver.impl.registry.NewInstanceServiceRegistration<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.constructorHandle- the method handle of the constructor to call to obtain a new service instance.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 NewInstanceServiceRegistration<S>(@NonNull Class<S> serviceType, @NonNull String serviceName, @NonNull MethodHandle constructorHandle, @NonNull ServiceRegistrationsBinding<S> binding)
extends Record
implements eu.cloudnetservice.driver.registry.ServiceRegistryRegistration<S>
A service registration which obtains a new instance of the service implementation on each invocation.
- Since:
- 4.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final @NonNull ServiceRegistrationsBinding<S> The field for thebindingrecord component.private final @NonNull MethodHandleThe field for theconstructorHandlerecord component.The field for theserviceNamerecord component.The field for theserviceTyperecord component. -
Constructor Summary
ConstructorsConstructorDescriptionNewInstanceServiceRegistration(@NonNull Class<S> serviceType, @NonNull String serviceName, @NonNull MethodHandle constructorHandle, @NonNull ServiceRegistrationsBinding<S> binding) Creates an instance of aNewInstanceServiceRegistrationrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbinding()Returns the value of thebindingrecord component.Returns the value of theconstructorHandlerecord component.booleanfinal 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 theserviceNamerecord component.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. -
serviceName
The field for theserviceNamerecord component. -
constructorHandle
The field for theconstructorHandlerecord component. -
binding
The field for thebindingrecord component.
-
-
Constructor Details
-
NewInstanceServiceRegistration
NewInstanceServiceRegistration(@NonNull @NonNull Class<S> serviceType, @NonNull @NonNull String serviceName, @NonNull @NonNull MethodHandle constructorHandle, @NonNull @NonNull ServiceRegistrationsBinding<S> binding) Creates an instance of aNewInstanceServiceRegistrationrecord class.- Parameters:
serviceType- the value for theserviceTyperecord componentserviceName- the value for theserviceNamerecord componentconstructorHandle- the value for theconstructorHandlerecord componentbinding- the value for thebindingrecord component
-
-
Method Details
-
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
-
name
-
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
-
serviceName
Returns the value of theserviceNamerecord component.- Returns:
- the value of the
serviceNamerecord component
-
constructorHandle
Returns the value of theconstructorHandlerecord component.- Returns:
- the value of the
constructorHandlerecord component
-
binding
-