Record Class AutoServiceMapping
java.lang.Object
java.lang.Record
eu.cloudnetservice.driver.impl.registry.AutoServiceMapping
- Record Components:
serviceType- the service type that is implemented by the implementation type.implementationType- the type that implements the given service type.serviceName- the name that should be used for the service registration.singletonService- if the service instance should be allocated once or every time it is retrieved.markServiceAsDefault- if the service should be marked as the default service after registration.
record AutoServiceMapping(@NonNull Class<?> serviceType, @NonNull Class<?> implementationType, @NonNull String serviceName, boolean singletonService, boolean markServiceAsDefault)
extends Record
A mapping of all properties set in an
AutoService annotation on an
implementation class. This class is deserialized from information provided during compilation via an annotation
processor.- Since:
- 4.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe field for theimplementationTyperecord component.private final booleanThe field for themarkServiceAsDefaultrecord component.The field for theserviceNamerecord component.The field for theserviceTyperecord component.private final booleanThe field for thesingletonServicerecord component. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic @NonNull AutoServiceMappingdeserialize(@NonNull Class<?> caller, @NonNull DataInput dataInput) Deserializes an auto service mapping from the given data input.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of theimplementationTyperecord component.booleanReturns the value of themarkServiceAsDefaultrecord component.Returns the value of theserviceNamerecord component.Returns the value of theserviceTyperecord component.booleanReturns the value of thesingletonServicerecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
serviceType
The field for theserviceTyperecord component. -
implementationType
The field for theimplementationTyperecord component. -
serviceName
The field for theserviceNamerecord component. -
singletonService
private final boolean singletonServiceThe field for thesingletonServicerecord component. -
markServiceAsDefault
private final boolean markServiceAsDefaultThe field for themarkServiceAsDefaultrecord component.
-
-
Constructor Details
-
AutoServiceMapping
AutoServiceMapping(@NonNull @NonNull Class<?> serviceType, @NonNull @NonNull Class<?> implementationType, @NonNull @NonNull String serviceName, boolean singletonService, boolean markServiceAsDefault) Creates an instance of aAutoServiceMappingrecord class.- Parameters:
serviceType- the value for theserviceTyperecord componentimplementationType- the value for theimplementationTyperecord componentserviceName- the value for theserviceNamerecord componentsingletonService- the value for thesingletonServicerecord componentmarkServiceAsDefault- the value for themarkServiceAsDefaultrecord component
-
-
Method Details
-
deserialize
@NonNull public static @NonNull AutoServiceMapping deserialize(@NonNull @NonNull Class<?> caller, @NonNull @NonNull DataInput dataInput) throws IOException, ClassNotFoundException Deserializes an auto service mapping from the given data input. Class references are loaded using the class loader of the given caller class. The data input must be prefixed with a single byte indicating the data version followed by all the information needed to construct this mapping.- Parameters:
caller- the caller that requested deserialization of the mappings.dataInput- the data input from which the mappings should be deserialized.- Returns:
- a deserialized auto service mapping based on the given data input.
- Throws:
IOException- if an I/O error occurs while reading the mapping.ClassNotFoundException- if a referenced class in the mapping cannot be resolved.NullPointerException- if the given caller class or data input is null.IllegalStateException- if an unknown auto service mapping data version is provided.
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
serviceType
Returns the value of theserviceTyperecord component.- Returns:
- the value of the
serviceTyperecord component
-
implementationType
Returns the value of theimplementationTyperecord component.- Returns:
- the value of the
implementationTyperecord component
-
serviceName
Returns the value of theserviceNamerecord component.- Returns:
- the value of the
serviceNamerecord component
-
singletonService
public boolean singletonService()Returns the value of thesingletonServicerecord component.- Returns:
- the value of the
singletonServicerecord component
-
markServiceAsDefault
public boolean markServiceAsDefault()Returns the value of themarkServiceAsDefaultrecord component.- Returns:
- the value of the
markServiceAsDefaultrecord component
-