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 Details

  • Constructor Details

  • Method Details

    • deserialize

      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

      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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      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<?> serviceType()
      Returns the value of the serviceType record component.
      Returns:
      the value of the serviceType record component
    • implementationType

      @NonNull public @NonNull Class<?> implementationType()
      Returns the value of the implementationType record component.
      Returns:
      the value of the implementationType record component
    • serviceName

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

      public boolean singletonService()
      Returns the value of the singletonService record component.
      Returns:
      the value of the singletonService record component
    • markServiceAsDefault

      public boolean markServiceAsDefault()
      Returns the value of the markServiceAsDefault record component.
      Returns:
      the value of the markServiceAsDefault record component