Record Class TagImpl<T>

java.lang.Object
java.lang.Record
net.minestom.server.tag.TagImpl<T>
All Implemented Interfaces:
Tag<T>

public record TagImpl<T>(int index, String key, Function<?,?> readComparator, net.minestom.server.tag.Serializers.Entry<T, BinaryTag> entry, @Nullable Supplier<@Nullable T> defaultValue, TagImpl.PathEntry @Nullable [] path, @Nullable UnaryOperator<T> copy, int listScope) extends Record implements Tag<T>
  • Constructor Details

    • TagImpl

      public TagImpl(int index, String key, Function<?,?> readComparator, net.minestom.server.tag.Serializers.Entry<T, BinaryTag> entry, @Nullable @Nullable Supplier<@Nullable T> defaultValue, TagImpl.PathEntry @Nullable [] path, @Nullable @Nullable UnaryOperator<T> copy, int listScope)
      Creates an instance of a TagImpl record class.
      Parameters:
      index - the value for the index record component
      key - the value for the key record component
      readComparator - the value for the readComparator record component
      entry - the value for the entry record component
      defaultValue - the value for the defaultValue record component
      path - the value for the path record component
      copy - the value for the copy record component
      listScope - the value for the listScope record component
  • Method Details

    • getKey

      public String getKey()
      Description copied from interface: Tag
      Use Tag.key() instead
      Specified by:
      getKey in interface Tag<T>
      Returns:
      the key
    • key

      public String key()
      Returns the value of the key record component.
      Specified by:
      key in interface Tag<T>
      Returns:
      the value of the key record component
    • defaultValue

      @Contract(value="_ -> new", pure=true) public Tag<T> defaultValue(Supplier<T> defaultValue)
      Specified by:
      defaultValue in interface Tag<T>
    • defaultValue

      @Contract(value="_ -> new", pure=true) public Tag<T> defaultValue(T defaultValue)
      Specified by:
      defaultValue in interface Tag<T>
    • map

      @Contract(value="_, _ -> new", pure=true) public <R extends @UnknownNullability Object> Tag<R> map(Function<T,R> readMap, Function<R,T> writeMap)
      Specified by:
      map in interface Tag<T>
    • list

      @Contract(value="-> new", pure=true) public Tag<List<T>> list()
      Specified by:
      list in interface Tag<T>
    • path

      @Contract(value="_ -> new", pure=true) public Tag<T> path(String @Nullable ... path)
      Specified by:
      path in interface Tag<T>
    • read

      @Nullable public T read(CompoundBinaryTag nbt)
      Specified by:
      read in interface Tag<T>
    • write

      public void write(CompoundBinaryTag.Builder nbtCompound, @Nullable T value)
      Specified by:
      write in interface Tag<T>
    • writeUnsafe

      public void writeUnsafe(CompoundBinaryTag.Builder nbtCompound, @Nullable @Nullable Object value)
      Specified by:
      writeUnsafe in interface Tag<T>
    • isView

      public boolean isView()
      Specified by:
      isView in interface Tag<T>
    • shareValue

      public boolean shareValue(Tag<?> other)
      Specified by:
      shareValue in interface Tag<T>
    • createDefault

      @Nullable public T createDefault()
      Specified by:
      createDefault in interface Tag<T>
    • copyValue

      public T copyValue(T value)
      Specified by:
      copyValue in interface Tag<T>
    • equals

      public 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.
    • hashCode

      public 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
    • 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
    • index

      public int index()
      Returns the value of the index record component.
      Returns:
      the value of the index record component
    • readComparator

      public Function<?,?> readComparator()
      Returns the value of the readComparator record component.
      Returns:
      the value of the readComparator record component
    • entry

      public net.minestom.server.tag.Serializers.Entry<T, BinaryTag> entry()
      Returns the value of the entry record component.
      Returns:
      the value of the entry record component
    • defaultValue

      @Nullable public @Nullable Supplier<@Nullable T> defaultValue()
      Returns the value of the defaultValue record component.
      Returns:
      the value of the defaultValue record component
    • path

      public TagImpl.PathEntry @Nullable [] path()
      Returns the value of the path record component.
      Returns:
      the value of the path record component
    • copy

      Returns the value of the copy record component.
      Returns:
      the value of the copy record component
    • listScope

      public int listScope()
      Returns the value of the listScope record component.
      Returns:
      the value of the listScope record component