Java Code Examples for org.yaml.snakeyaml.DumperOptions#setLineBreak()
The following examples show how to use
org.yaml.snakeyaml.DumperOptions#setLineBreak() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SaltStateGenerator.java From uyuni with GNU General Public License v2.0 | 5 votes |
/** * Generate the YAML. * * @param states the states to output * */ public void generate(SaltState... states) { DumperOptions setup = new DumperOptions(); setup.setIndent(4); setup.setAllowUnicode(true); setup.setPrettyFlow(true); setup.setLineBreak(DumperOptions.LineBreak.UNIX); setup.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK); setup.setCanonical(false); Yaml yaml = new Yaml(setup); for (SaltState state : states) { yaml.dump(state.getData(), destination); } }
Example 2
Source File: YAMLoptimizerParser.java From SeaCloudsPlatform with Apache License 2.0 | 5 votes |
public static String fromMAPtoYAMLstring(Map<String, Object> appMap) { DumperOptions options = new DumperOptions(); options.setLineBreak(DumperOptions.LineBreak.getPlatformLineBreak()); options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK); Yaml yml = new Yaml(options); Yaml yamlApp = new Yaml(options); return yamlApp.dump(appMap); }
Example 3
Source File: DefaultStreamService.java From spring-cloud-dataflow with Apache License 2.0 | 4 votes |
String convertPropertiesToSkipperYaml(StreamDefinition streamDefinition, Map<String, String> updateProperties) { List<AppDeploymentRequest> appDeploymentRequests = this.appDeploymentRequestCreator .createUpdateRequests(streamDefinition, updateProperties); Map<String, Object> skipperConfigValuesMap = new HashMap<>(); for (AppDeploymentRequest appDeploymentRequest : appDeploymentRequests) { boolean hasProps = false; String appName = appDeploymentRequest.getDefinition().getName(); Map<String, Object> appMap = new HashMap<>(); Map<String, Object> specMap = new HashMap<>(); if (!appDeploymentRequest.getDefinition().getProperties().isEmpty()) { hasProps = true; specMap.put(SpringCloudDeployerApplicationSpec.APPLICATION_PROPERTIES_STRING, appDeploymentRequest.getDefinition().getProperties()); } if (!appDeploymentRequest.getDeploymentProperties().isEmpty()) { hasProps = true; specMap.put(SpringCloudDeployerApplicationSpec.DEPLOYMENT_PROPERTIES_STRING, appDeploymentRequest.getDeploymentProperties()); } if (appDeploymentRequest.getCommandlineArguments().size() == 1) { hasProps = true; String version = appDeploymentRequest.getCommandlineArguments().get(0); this.skipperStreamDeployer.validateAppVersionIsRegistered(streamDefinition, appDeploymentRequest, version); specMap.put("version", version); } if (hasProps) { appMap.put(SpringCloudDeployerApplicationManifest.SPEC_STRING, specMap); } if (appMap.size() != 0) { skipperConfigValuesMap.put(appName, appMap); } } if (!skipperConfigValuesMap.isEmpty()) { DumperOptions dumperOptions = new DumperOptions(); dumperOptions.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK); dumperOptions.setPrettyFlow(true); dumperOptions.setLineBreak(DumperOptions.LineBreak.getPlatformLineBreak()); Yaml yaml = new Yaml(dumperOptions); return yaml.dump(skipperConfigValuesMap); } else { return ""; } }
Example 4
Source File: YAMLmatchmakerToOptimizerParser.java From SeaCloudsPlatform with Apache License 2.0 | 3 votes |
public static String fromListtoYAMLstring(List<Object> appMap) { DumperOptions options = new DumperOptions(); options.setLineBreak(DumperOptions.LineBreak.getPlatformLineBreak()); Yaml yamlApp = new Yaml(options); return yamlApp.dump(appMap); }