@Test void setOutputType() { jsonTools.setOutputType(JsonTools.YAML); assertTrue(jsonTools.getObjectMapper().getFactory() instanceof YAMLFactory); jsonTools.setOutputType(JsonTools.JSON); assertFalse(jsonTools.getObjectMapper().getFactory() instanceof YAMLFactory); jsonTools.setOutputType("xyz"); assertTrue(jsonTools.getObjectMapper().getFactory() instanceof YAMLFactory); }
public void setOutputType(String outputType) { if (JSON.equalsIgnoreCase(outputType)) { this.outputType = JSON; fileExtension = "." + JSON_EXTENSION; } else if (YAML.equalsIgnoreCase(outputType)) { this.outputType = YAML; fileExtension = "." + YML_EXTENSION; } else { LOGGER.log(Level.WARNING, "Output type specified is not YAML nor JSON. Using YAML as the default output type."); this.outputType = YAML; fileExtension = "." + YML_EXTENSION; } }
JsonTools { public void setOutputType(String outputType) { if (JSON.equalsIgnoreCase(outputType)) { this.outputType = JSON; fileExtension = "." + JSON_EXTENSION; } else if (YAML.equalsIgnoreCase(outputType)) { this.outputType = YAML; fileExtension = "." + YML_EXTENSION; } else { LOGGER.log(Level.WARNING, "Output type specified is not YAML nor JSON. Using YAML as the default output type."); this.outputType = YAML; fileExtension = "." + YML_EXTENSION; } } }
JsonTools { public void setOutputType(String outputType) { if (JSON.equalsIgnoreCase(outputType)) { this.outputType = JSON; fileExtension = "." + JSON_EXTENSION; } else if (YAML.equalsIgnoreCase(outputType)) { this.outputType = YAML; fileExtension = "." + YML_EXTENSION; } else { LOGGER.log(Level.WARNING, "Output type specified is not YAML nor JSON. Using YAML as the default output type."); this.outputType = YAML; fileExtension = "." + YML_EXTENSION; } } JsonTools(FileUtils fileUtils); }
JsonTools { public void setOutputType(String outputType) { if (JSON.equalsIgnoreCase(outputType)) { this.outputType = JSON; fileExtension = "." + JSON_EXTENSION; } else if (YAML.equalsIgnoreCase(outputType)) { this.outputType = YAML; fileExtension = "." + YML_EXTENSION; } else { LOGGER.log(Level.WARNING, "Output type specified is not YAML nor JSON. Using YAML as the default output type."); this.outputType = YAML; fileExtension = "." + YML_EXTENSION; } } 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 { public void setOutputType(String outputType) { if (JSON.equalsIgnoreCase(outputType)) { this.outputType = JSON; fileExtension = "." + JSON_EXTENSION; } else if (YAML.equalsIgnoreCase(outputType)) { this.outputType = YAML; fileExtension = "." + YML_EXTENSION; } else { LOGGER.log(Level.WARNING, "Output type specified is not YAML nor JSON. Using YAML as the default output type."); this.outputType = YAML; fileExtension = "." + YML_EXTENSION; } } 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; }