Class JsonTranslationFile

  • All Implemented Interfaces:
    TranslationFile

    public class JsonTranslationFile
    extends java.lang.Object
    implements TranslationFile
    Represents a translation file implementation, utilising the ".json" file type using jackson as library.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      @NotNull java.lang.String getFileType()
      Returns the translation file type.
      @NotNull java.util.Collection<java.lang.String> getKeys()
      Returns the keys of all translations present
      @NotNull java.lang.String getString​(java.lang.String key)
      Returns the translation with the specified key, or empty if the translation doesn't exist.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • JsonTranslationFile

        public JsonTranslationFile​(java.io.InputStream in,
                                   com.fasterxml.jackson.databind.ObjectMapper mapper)
                            throws java.io.IOException
        Throws:
        java.io.IOException
      • JsonTranslationFile

        public JsonTranslationFile​(java.io.InputStream in)
                            throws java.io.IOException
        Throws:
        java.io.IOException
      • JsonTranslationFile

        public JsonTranslationFile​(java.io.Reader in,
                                   com.fasterxml.jackson.databind.ObjectMapper mapper)
                            throws java.io.IOException
        Throws:
        java.io.IOException
      • JsonTranslationFile

        public JsonTranslationFile​(java.io.Reader in)
                            throws java.io.IOException
        Throws:
        java.io.IOException
    • Method Detail

      • getString

        @NotNull
        public @NotNull java.lang.String getString​(java.lang.String key)
        Description copied from interface: TranslationFile
        Returns the translation with the specified key, or empty if the translation doesn't exist.
        Specified by:
        getString in interface TranslationFile
        Parameters:
        key - key
        Returns:
        translation or empty string
      • getFileType

        @NotNull
        public @NotNull java.lang.String getFileType()
        Description copied from interface: TranslationFile
        Returns the translation file type.
        Specified by:
        getFileType in interface TranslationFile
        Returns:
        file type
      • getKeys

        @NotNull
        public @NotNull java.util.Collection<java.lang.String> getKeys()
        Description copied from interface: TranslationFile
        Returns the keys of all translations present
        Specified by:
        getKeys in interface TranslationFile
        Returns:
        keys