Package com.mrivanplays.jdcf.translation
Class JsonTranslationFile
- java.lang.Object
-
- com.mrivanplays.jdcf.translation.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.
-
-
Constructor Summary
Constructors Constructor Description JsonTranslationFile(java.io.InputStream in)JsonTranslationFile(java.io.InputStream in, com.fasterxml.jackson.databind.ObjectMapper mapper)JsonTranslationFile(java.io.Reader in)JsonTranslationFile(java.io.Reader in, com.fasterxml.jackson.databind.ObjectMapper mapper)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull java.lang.StringgetFileType()Returns the translation file type.@NotNull java.util.Collection<java.lang.String>getKeys()Returns the keys of all translations present@NotNull java.lang.StringgetString(java.lang.String key)Returns the translation with the specified key, or empty if the translation doesn't exist.
-
-
-
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:TranslationFileReturns the translation with the specified key, or empty if the translation doesn't exist.- Specified by:
getStringin interfaceTranslationFile- Parameters:
key- key- Returns:
- translation or empty string
-
getFileType
@NotNull public @NotNull java.lang.String getFileType()
Description copied from interface:TranslationFileReturns the translation file type.- Specified by:
getFileTypein interfaceTranslationFile- Returns:
- file type
-
getKeys
@NotNull public @NotNull java.util.Collection<java.lang.String> getKeys()
Description copied from interface:TranslationFileReturns the keys of all translations present- Specified by:
getKeysin interfaceTranslationFile- Returns:
- keys
-
-