Record Class DefaultDataSyncHandler<T>

java.lang.Object
java.lang.Record
eu.cloudnetservice.node.impl.cluster.sync.DefaultDataSyncHandler<T>
All Implemented Interfaces:
eu.cloudnetservice.node.cluster.sync.DataSyncHandler<T>

public record DefaultDataSyncHandler<T>(@NonNull String key, boolean alwaysForceApply, @NonNull eu.cloudnetservice.node.cluster.sync.DataSyncHandler.DataConverter<T> converter, @NonNull Consumer<T> writer, @NonNull UnaryOperator<T> currentGetter, @NonNull Function<T,String> nameExtractor, @NonNull Supplier<Collection<T>> dataCollector) extends Record implements eu.cloudnetservice.node.cluster.sync.DataSyncHandler<T>
  • Field Details

    • key

      @NonNull private final @NonNull String key
      The field for the key record component.
    • alwaysForceApply

      private final boolean alwaysForceApply
      The field for the alwaysForceApply record component.
    • converter

      @NonNull private final @NonNull eu.cloudnetservice.node.cluster.sync.DataSyncHandler.DataConverter<T> converter
      The field for the converter record component.
    • writer

      @NonNull private final @NonNull Consumer<T> writer
      The field for the writer record component.
    • currentGetter

      @NonNull private final @NonNull UnaryOperator<T> currentGetter
      The field for the currentGetter record component.
    • nameExtractor

      @NonNull private final @NonNull Function<T,String> nameExtractor
      The field for the nameExtractor record component.
    • dataCollector

      @NonNull private final @NonNull Supplier<Collection<T>> dataCollector
      The field for the dataCollector record component.
  • Constructor Details

    • DefaultDataSyncHandler

      public DefaultDataSyncHandler(@NonNull @NonNull String key, boolean alwaysForceApply, @NonNull @NonNull eu.cloudnetservice.node.cluster.sync.DataSyncHandler.DataConverter<T> converter, @NonNull @NonNull Consumer<T> writer, @NonNull @NonNull UnaryOperator<T> currentGetter, @NonNull @NonNull Function<T,String> nameExtractor, @NonNull @NonNull Supplier<Collection<T>> dataCollector)
      Creates an instance of a DefaultDataSyncHandler record class.
      Parameters:
      key - the value for the key record component
      alwaysForceApply - the value for the alwaysForceApply record component
      converter - the value for the converter record component
      writer - the value for the writer record component
      currentGetter - the value for the currentGetter record component
      nameExtractor - the value for the nameExtractor record component
      dataCollector - the value for the dataCollector record component
  • Method Details

    • builder

      @NonNull public static <T> @NonNull DefaultDataSyncHandler.Builder<T> builder()
    • name

      Specified by:
      name in interface eu.cloudnetservice.node.cluster.sync.DataSyncHandler<T>
    • write

      public void write(@NonNull @NonNull Object data)
      Specified by:
      write in interface eu.cloudnetservice.node.cluster.sync.DataSyncHandler<T>
    • serialize

      public void serialize(@NonNull eu.cloudnetservice.driver.network.buffer.DataBuf.Mutable target, @NonNull @NonNull Object data)
      Specified by:
      serialize in interface eu.cloudnetservice.node.cluster.sync.DataSyncHandler<T>
    • current

      @Nullable public T current(@NonNull @NonNull Object toGet)
      Specified by:
      current in interface eu.cloudnetservice.node.cluster.sync.DataSyncHandler<T>
    • data

      @NonNull public @NonNull Collection<T> data()
      Specified by:
      data in interface eu.cloudnetservice.node.cluster.sync.DataSyncHandler<T>
    • 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.
    • key

      @NonNull public @NonNull String key()
      Returns the value of the key record component.
      Specified by:
      key in interface eu.cloudnetservice.node.cluster.sync.DataSyncHandler<T>
      Returns:
      the value of the key record component
    • alwaysForceApply

      public boolean alwaysForceApply()
      Returns the value of the alwaysForceApply record component.
      Specified by:
      alwaysForceApply in interface eu.cloudnetservice.node.cluster.sync.DataSyncHandler<T>
      Returns:
      the value of the alwaysForceApply record component
    • converter

      @NonNull public @NonNull eu.cloudnetservice.node.cluster.sync.DataSyncHandler.DataConverter<T> converter()
      Returns the value of the converter record component.
      Specified by:
      converter in interface eu.cloudnetservice.node.cluster.sync.DataSyncHandler<T>
      Returns:
      the value of the converter record component
    • writer

      @NonNull public @NonNull Consumer<T> writer()
      Returns the value of the writer record component.
      Specified by:
      writer in interface eu.cloudnetservice.node.cluster.sync.DataSyncHandler<T>
      Returns:
      the value of the writer record component
    • currentGetter

      @NonNull public @NonNull UnaryOperator<T> currentGetter()
      Returns the value of the currentGetter record component.
      Specified by:
      currentGetter in interface eu.cloudnetservice.node.cluster.sync.DataSyncHandler<T>
      Returns:
      the value of the currentGetter record component
    • nameExtractor

      @NonNull public @NonNull Function<T,String> nameExtractor()
      Returns the value of the nameExtractor record component.
      Specified by:
      nameExtractor in interface eu.cloudnetservice.node.cluster.sync.DataSyncHandler<T>
      Returns:
      the value of the nameExtractor record component
    • dataCollector

      @NonNull public @NonNull Supplier<Collection<T>> dataCollector()
      Returns the value of the dataCollector record component.
      Specified by:
      dataCollector in interface eu.cloudnetservice.node.cluster.sync.DataSyncHandler<T>
      Returns:
      the value of the dataCollector record component