@Test void getTypeFromExtension() { assertEquals(JsonTools.YAML, jsonTools.getTypeFromExtension("yml")); assertEquals(JsonTools.YAML, jsonTools.getTypeFromExtension("yaml")); assertEquals(JsonTools.JSON, jsonTools.getTypeFromExtension("json")); assertNull(jsonTools.getTypeFromExtension("test.txt")); }
@Nullable public String getTypeFromExtension(String extension) { switch (extension) { case JSON_EXTENSION: return JSON; case YML_EXTENSION: case YAML_EXTENSION: return YAML; default: return null; } }
JsonTools { @Nullable public String getTypeFromExtension(String extension) { switch (extension) { case JSON_EXTENSION: return JSON; case YML_EXTENSION: case YAML_EXTENSION: return YAML; default: return null; } } }
JsonTools { @Nullable public String getTypeFromExtension(String extension) { switch (extension) { case JSON_EXTENSION: return JSON; case YML_EXTENSION: case YAML_EXTENSION: return YAML; default: return null; } } JsonTools(FileUtils fileUtils); }
JsonTools { @Nullable public String getTypeFromExtension(String extension) { switch (extension) { case JSON_EXTENSION: return JSON; case YML_EXTENSION: case YAML_EXTENSION: return YAML; default: return null; } } JsonTools(FileUtils fileUtils); ObjectMapper getObjectMapper(); ObjectWriter getObjectWriter(); ObjectWriter getObjectWriter(String outputType); ObjectMapper getObjectMapper(final String type); File getDocumentFile(final File rootDir, final String fileName); T readDocumentFile(final File file, final JavaType entityMapType); T readStream(final InputStream stream, final String type, final JavaType entityMapType); @NotNull String getTypeFromFile(File file); @Nullable String getTypeFromExtension(String extension); void setOutputType(String outputType); String getFileExtension(); void writeObject(final Object object, OutputStream outputStream); }
JsonTools { @Nullable public String getTypeFromExtension(String extension) { switch (extension) { case JSON_EXTENSION: return JSON; case YML_EXTENSION: case YAML_EXTENSION: return YAML; default: return null; } } JsonTools(FileUtils fileUtils); ObjectMapper getObjectMapper(); ObjectWriter getObjectWriter(); ObjectWriter getObjectWriter(String outputType); ObjectMapper getObjectMapper(final String type); File getDocumentFile(final File rootDir, final String fileName); T readDocumentFile(final File file, final JavaType entityMapType); T readStream(final InputStream stream, final String type, final JavaType entityMapType); @NotNull String getTypeFromFile(File file); @Nullable String getTypeFromExtension(String extension); void setOutputType(String outputType); String getFileExtension(); void writeObject(final Object object, OutputStream outputStream); static final JsonTools INSTANCE; static final String JSON; static final String YAML; static final String JSON_EXTENSION; static final String YML_EXTENSION; static final String YAML_EXTENSION; }