Class TranslationKey


  • public class TranslationKey
    extends Object
    A TranslationKey is a value meant to be translated, it is composed of a key, and optional arguments.

    The class is mutable to improve performances, but only accessible from its package.

    Author:
    Grégory Van den Borre specfield key:String:TranslationKey to translate. specfield args:Object[]:Optional arguments.
    • Method Detail

      • get

        public static TranslationKey get​(String key)
        Create a new instance of TranslationKey with a key and no arguments.
        Parameters:
        key - TranslationKey to translate.
        Returns:
        The build TranslationKey.
      • get

        public static TranslationKey get​(String key,
                                         Object... args)
        Create a new instance of TranslationKey with a key and arguments.
        Parameters:
        key - TranslationKey to translate.
        args - Arguments to use for translation.
        Returns:
        The build TranslationKey.
      • get

        public static TranslationKey.MultiKey get​(TranslationKey... keys)
        Create a new instance of MultiKey to use several translation at once.
        Parameters:
        keys - Keys to translate, must be at least one, and no null values is allowed.
        Returns:
        The build MultiKey.
      • isEmpty

        public boolean isEmpty()
        Check if the key is empty.
        Returns:
        true if the key is empty.
      • hashCode

        public final int hashCode()
        Overrides:
        hashCode in class Object