Record Class NamespaceID

java.lang.Object
java.lang.Record
net.minestom.server.utils.NamespaceID
All Implemented Interfaces:
CharSequence, Comparable<net.kyori.adventure.key.Key>, net.kyori.adventure.key.Key, net.kyori.adventure.key.Keyed, net.kyori.adventure.key.Namespaced, net.kyori.examination.Examinable

public record NamespaceID(@NotNull String domain, @NotNull String path) extends Record implements CharSequence, net.kyori.adventure.key.Key
Represents a namespaced ID https://minecraft.wiki/w/Namespaced_ID
  • Field Summary

    Fields inherited from interface net.kyori.adventure.key.Key

    DEFAULT_SEPARATOR, MINECRAFT_NAMESPACE
  • Constructor Summary

    Constructors
    Constructor
    Description
    NamespaceID(@NotNull String domain, @NotNull String path)
    Creates an instance of a NamespaceID record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    @NotNull String
     
    char
    charAt(int index)
     
    @NotNull String
    Returns the value of the domain record component.
    boolean
    Indicates whether some other object is "equal to" this one.
    static @NotNull NamespaceID
    from(@NotNull String namespace)
     
    static @NotNull NamespaceID
    from(@NotNull String domain, @NotNull String path)
     
    static @NotNull NamespaceID
    from(@NotNull net.kyori.adventure.key.Key key)
     
    int
    Returns a hash code value for this object.
    int
     
    @NotNull String
     
    @NotNull String
    Returns the value of the path record component.
    @NotNull CharSequence
    subSequence(int start, int end)
     
    @NotNull String
    Returns a string representation of this record class.
    @NotNull String
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface java.lang.CharSequence

    chars, codePoints, isEmpty

    Methods inherited from interface net.kyori.examination.Examinable

    examinableName, examine

    Methods inherited from interface net.kyori.adventure.key.Key

    asMinimalString, compareTo, examinableProperties, key
  • Constructor Details

    • NamespaceID

      public NamespaceID(@NotNull @NotNull String domain, @NotNull @NotNull String path)
      Creates an instance of a NamespaceID record class.
      Parameters:
      domain - the value for the domain record component
      path - the value for the path record component
  • Method Details

    • from

      @NotNull public static @NotNull NamespaceID from(@NotNull @NotNull String namespace)
    • from

      @NotNull public static @NotNull NamespaceID from(@NotNull @NotNull String domain, @NotNull @NotNull String path)
    • from

      @NotNull public static @NotNull NamespaceID from(@NotNull @NotNull net.kyori.adventure.key.Key key)
    • length

      public int length()
      Specified by:
      length in interface CharSequence
    • charAt

      public char charAt(int index)
      Specified by:
      charAt in interface CharSequence
    • subSequence

      @NotNull public @NotNull CharSequence subSequence(int start, int end)
      Specified by:
      subSequence in interface CharSequence
    • namespace

      @Pattern("[a-z0-9_\\-.]+") @NotNull public @NotNull String namespace()
      Specified by:
      namespace in interface net.kyori.adventure.key.Key
      Specified by:
      namespace in interface net.kyori.adventure.key.Namespaced
    • value

      @NotNull public @NotNull String value()
      Specified by:
      value in interface net.kyori.adventure.key.Key
    • asString

      @NotNull public @NotNull String asString()
      Specified by:
      asString in interface net.kyori.adventure.key.Key
    • toString

      @NotNull public @NotNull 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 interface CharSequence
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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. All components in this record class are compared with Objects::equals(Object,Object).
      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
    • domain

      @NotNull public @NotNull String domain()
      Returns the value of the domain record component.
      Returns:
      the value of the domain record component
    • path

      @NotNull public @NotNull String path()
      Returns the value of the path record component.
      Returns:
      the value of the path record component