Record Class MazeId

java.lang.Object
java.lang.Record
dev.despical.mazeengine.api.model.MazeId
Record Components:
value - the case-insensitive maze name, stored in normalized form

public record MazeId(String value) extends Record
Identifies a saved maze using the same naming rules as commands.

Input is normalized to lowercase with Locale.ROOT. Identifiers contain 1 through 48 ASCII letters, digits, underscores, or hyphens. Names reserved by the filesystem, such as con and lpt1, are rejected so persistence can use the identifier safely.

Equality compares normalized values. The identifier is a name, not a unique operation identity; a deleted name may later identify a newly created maze.

  • Constructor Summary

    Constructors
    Constructor
    Description
    MazeId(String value)
    Normalizes and validates a maze name.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    @NotNull String
    Returns the normalized identifier itself.
    Returns the value of the value record component.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • MazeId

      public MazeId(String value)
      Normalizes and validates a maze name.

      Surrounding whitespace is not trimmed. Reserved device names are rejected after normalization, including COM1..COM9 and LPT1..LPT9.

      Parameters:
      value - the maze name to normalize
      Throws:
      NullPointerException - if value is null
      IllegalArgumentException - if the normalized name is invalid or reserved
  • Method Details

    • toString

      @NotNull public @NotNull String toString()
      Returns the normalized identifier itself.

      This representation can be used wherever the plugin expects a maze name. It does not include a record-style field label or class name.

      Specified by:
      toString in class Record
      Returns:
      the lowercase saved maze name
    • 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. 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.
    • value

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