Interface LocalizationKey


public interface LocalizationKey
Represents a localization key used for retrieving localized messages.

By default, the key is derived from Object.toString() and is converted to lowercase with '$' replaced by '.'.

  • Method Summary

    Modifier and Type
    Method
    Description
    default @NotNull String
    key()
    Returns the key for this localization.
    of(@NotNull String key)
    Creates a new LocalizationKey with the specified key.
    of(@NotNull String key, @NotNull String... parameters)
    Creates a new LocalizationKey with the specified key and parameters.
    default String[]
    Returns the parameters associated with this localization key.
  • Method Details

    • of

      static LocalizationKey of(@NotNull @NotNull String key)
      Creates a new LocalizationKey with the specified key.

      If you want to use parameters, use of(String, String...) instead.

      Parameters:
      key - the key for the localization
      Returns:
      a new LocalizationKey instance
    • of

      static LocalizationKey of(@NotNull @NotNull String key, @NotNull @NotNull String... parameters)
      Creates a new LocalizationKey with the specified key and parameters.
      Parameters:
      key - the key for the localization
      parameters - the parameters to be used in the localization
      Returns:
      a new LocalizationKey instance with parameters
    • key

      @NotNull default @NotNull String key()
      Returns the key for this localization.
      Returns:
      the key as a lowercase string with '$' replaced by '.'
    • parameters

      default String[] parameters()
      Returns the parameters associated with this localization key. If no parameters are defined, an empty array is returned.

      You can use the Parameters annotation to define parameters for a localization key.

      Returns:
      an array of parameters