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.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.
-
-
-
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 interfaceTranslationFile
- 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 interfaceTranslationFile
- 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 interfaceTranslationFile
- Returns:
- keys
-
-