Class Key

java.lang.Object
xyz.jpenilla.squaremap.api.Key

public final class Key extends Object
Simple string wrapper used to identify things. Equality is checked based only on the key string.

Valid characters for keys are [a-zA-Z0-9._-].

In most cases keys should be unique, so prefixing keys with a plugin name, for example "myplugin_layer-1", would be good practice.

  • Method Details

    • of

      public static @NonNull Key of(@NonNull String key)
      Get a new Key instance for the provided key string.
      Parameters:
      key - string for the key
      Returns:
      new key
    • key

      public static @NonNull Key key(@NonNull String key)
      Get a new Key instance for the provided key string.
      Parameters:
      key - string for the key
      Returns:
      new key
    • getKey

      public @NonNull String getKey()
      Get the key string for this key
      Returns:
      key string
    • equals

      public boolean equals(@Nullable Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public @NonNull String toString()
      Overrides:
      toString in class Object