public TypeDescription addTypeDescription(TypeDescription td) { if (Collections.EMPTY_MAP == typeDefinitions) { typeDefinitions = new HashMap<Class<? extends Object>, TypeDescription>(); } if (td.getTag() != null) { addClassTag(td.getType(), td.getTag()); } td.setPropertyUtils(getPropertyUtils()); return typeDefinitions.put(td.getType(), td); }
private static Representer getRepresenter() { Representer representer = new LockDescriptorAwareRepresenter(); representer.addClassTag(ImmutableSimpleTokenInfo.class, Tag.MAP); representer.addClassTag(ImmutableSimpleLockRequest.class, Tag.MAP); representer.addClassTag(ImmutableSanitizedLockRequestProgress.class, Tag.MAP); representer.addClassTag(SimpleLockRequestsWithSameDescriptor.class, Tag.MAP); representer.addClassTag(LockDescriptor.class, Tag.MAP); return representer; }
public static void configureRepresenter(Representer r) { for (Map.Entry<Class<?>, Tag> entry : YAML_CLASS_TAGS.entrySet()) { r.addClassTag(entry.getKey(), entry.getValue()); } }
private Representer setupRepresenter() { Representer representer = new JodaTimeRepresenter(); representer.addClassTag(ChartEntry.class, Tag.MAP); return representer; }
Representer representer = new Representer(); representer.addClassTag(com.test.yml.User.class, Tag.MAP); Yaml yaml = new Yaml(representer);
Representer representer = new Representer(); representer.addClassTag(com.test.users.Configuration.class, Tag.MAP); Yaml yaml = new Yaml(representer);
public static void addTag(Class<?> type, String tag) { YamlConfig.yaml.get().getRepresenter().addClassTag(type, new Tag(tag)); }
Representer representer = new Representer(); representer.addClassTag(Person.class, Tag.MAP);
private String convertToYml(Map<String, Object> dockerComposeData) { DumperOptions options = new DumperOptions(); options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK); options.setLineBreak(LineBreak.WIN); Representer representer = new SkipNullRepresenter(); representer.addClassTag(LBConfigMetadataStyle.class, Tag.MAP); Yaml yaml = new Yaml(representer, options); String yamlStr = yaml.dump(dockerComposeData); return yamlStr.replaceAll("[$]", "\\$\\$"); }
public TypeDescription addTypeDescription(TypeDescription td) { if (Collections.EMPTY_MAP == typeDefinitions) { typeDefinitions = new HashMap<Class<? extends Object>, TypeDescription>(); } if (td.getTag() != null) { addClassTag(td.getType(), td.getTag()); } td.setPropertyUtils(getPropertyUtils()); return typeDefinitions.put(td.getType(), td); }
private static void configYamlFormat(final ToolBelt belt, final RdClientConfig config) { DumperOptions dumperOptions = new DumperOptions(); dumperOptions.setDefaultFlowStyle( "BLOCK".equalsIgnoreCase(config.getString("RD_YAML_FLOW", "BLOCK")) ? DumperOptions.FlowStyle.BLOCK : DumperOptions.FlowStyle.FLOW ); dumperOptions.setPrettyFlow(config.getBool("RD_YAML_PRETTY", true)); Representer representer = new Representer(); representer.addClassTag(JobItem.class, Tag.MAP); representer.addClassTag(ScheduledJobItem.class, Tag.MAP); representer.addClassTag(DateInfo.class, Tag.MAP); representer.addClassTag(Execution.class, Tag.MAP); belt.formatter(new YamlFormatter(DataOutputAsFormatable, new Yaml(representer, dumperOptions))); belt.channels().infoEnabled(false); belt.channels().warningEnabled(false); belt.channels().errorEnabled(false); }
/** * Returns a new, properly configured YAML instance, able to write and read * key mappings. * * @return a new {@link Yaml} instance. */ private static final Yaml getYaml() { final Representer representer = new Representer(); representer.addClassTag( InputTriggerDescription.class, tag ); final Constructor constructor = new Constructor(); constructor.addTypeDescription( new TypeDescription( InputTriggerDescription.class, tag ) ); final DumperOptions options = new DumperOptions(); options.setExplicitStart( true ); final Yaml yaml = new Yaml( constructor, representer, options ); return yaml; }
private Yaml getYaml() { Representer representer = new TapeRepresenter(fileResolver); representer.addClassTag(YamlTape.class, YamlTape.TAPE_TAG); Constructor constructor = new TapeConstructor(fileResolver); constructor.addTypeDescription(new TypeDescription(YamlTape.class, YamlTape.TAPE_TAG)); DumperOptions dumperOptions = new DumperOptions(); dumperOptions.setDefaultFlowStyle(BLOCK); dumperOptions.setWidth(256); Yaml yaml = new Yaml(constructor, representer, dumperOptions); yaml.setBeanAccess(BeanAccess.FIELD); return yaml; }
private static Yaml getYaml() { Representer representer = new TapeRepresenter(); representer.addClassTag(YamlTape.class, YamlTape.TAPE_TAG); Constructor constructor = new TapeConstructor(); constructor.addTypeDescription(new TypeDescription(YamlTape.class, YamlTape.TAPE_TAG)); DumperOptions dumperOptions = new DumperOptions(); dumperOptions.setDefaultFlowStyle(BLOCK); dumperOptions.setWidth(256); Yaml yaml = new Yaml(constructor, representer, dumperOptions); yaml.setBeanAccess(BeanAccess.FIELD); return yaml; } }
private static Yaml getYaml() { Representer representer = new TapeRepresenter(); representer.addClassTag(YamlTape.class, YamlTape.TAPE_TAG); Constructor constructor = new TapeConstructor(); constructor.addTypeDescription(new TypeDescription(YamlTape.class, YamlTape.TAPE_TAG)); DumperOptions dumperOptions = new DumperOptions(); dumperOptions.setDefaultFlowStyle(BLOCK); dumperOptions.setWidth(256); Yaml yaml = new Yaml(constructor, representer, dumperOptions); yaml.setBeanAccess(BeanAccess.FIELD); return yaml; } }
yamlRepresenter = new Representer(); yamlConstructor.addTypeDescription(new TypeDescription(GetSnapshot.class, "!getSnapshot")); yamlRepresenter.addClassTag(GetSnapshot.class, new org.yaml.snakeyaml.nodes.Tag("!getSnapshot")); yamlConstructor.addTypeDescription(new TypeDescription(Terminate.class, "!terminate")); yamlRepresenter.addClassTag(Terminate.class, new org.yaml.snakeyaml.nodes.Tag("!terminate")); yamlConstructor.addTypeDescription(new TypeDescription(ListenToAdded.class, "!listenToAdded")); yamlRepresenter.addClassTag(ListenToAdded.class, new org.yaml.snakeyaml.nodes.Tag("!listenToAdded")); yamlConstructor.addTypeDescription(new TypeDescription(Added.class, "!added")); yamlRepresenter.addClassTag(Added.class, new org.yaml.snakeyaml.nodes.Tag("!added")); yamlConstructor.addTypeDescription(new TypeDescription(Remove.class, "!remove")); yamlRepresenter.addClassTag(Remove.class, new org.yaml.snakeyaml.nodes.Tag("!remove")); yamlConstructor.addTypeDescription(new TypeDescription(Snapshot.class, "!snapshot")); yamlRepresenter.addClassTag(Snapshot.class, new org.yaml.snakeyaml.nodes.Tag("!snapshot")); yamlConstructor.addTypeDescription(new TypeDescription(Ack.class, "!ack")); yamlRepresenter.addClassTag(Ack.class, new org.yaml.snakeyaml.nodes.Tag("!ack")); yamlConstructor.addTypeDescription(new TypeDescription(Set.class, "!set")); yamlRepresenter.addClassTag(Set.class, new org.yaml.snakeyaml.nodes.Tag("!set")); yamlConstructor.addTypeDescription(new TypeDescription(Extended.class, "!extended")); yamlRepresenter.addClassTag(Extended.class, new org.yaml.snakeyaml.nodes.Tag("!extended")); yamlConstructor.addTypeDescription(new TypeDescription(CreateAndAdd.class, "!createAndAdd")); yamlRepresenter.addClassTag(CreateAndAdd.class, new org.yaml.snakeyaml.nodes.Tag("!createAndAdd")); yamlConstructor.addTypeDescription(new TypeDescription(Add.class, "!add")); yamlRepresenter.addClassTag(Add.class, new org.yaml.snakeyaml.nodes.Tag("!add")); yamlConstructor.addTypeDescription(new TypeDescription(Create.class, "!create")); yamlRepresenter.addClassTag(Create.class, new org.yaml.snakeyaml.nodes.Tag("!create")); yamlConstructor.addTypeDescription(new TypeDescription(Provision.class, "!provision")); yamlRepresenter.addClassTag(Provision.class, new org.yaml.snakeyaml.nodes.Tag("!provision")); yamlConstructor.addTypeDescription(new TypeDescription(ListenToFlush.class, "!listenToFlush")); yamlRepresenter.addClassTag(ListenToFlush.class, new org.yaml.snakeyaml.nodes.Tag("!listenToFlush"));
throws AraraException { Representer representer = new Representer(); representer.addClassTag(Rule.class, new Tag("!config")); Yaml yaml = new Yaml(new Constructor(Rule.class), representer); Rule rule = null;
public static Yaml newYaml() { PropertyUtils propertyUtils = new AdvancedPropertyUtils(); propertyUtils.setSkipMissingProperties(true); propertyUtils.setAllowReadOnlyProperties(false); Constructor constructor = new Constructor(); Representer representer = new AdvancedRepresenter(); representer.setPropertyUtils(propertyUtils); representer.addClassTag(CircusTrainConfig.class, Tag.MAP); DumperOptions dumperOptions = new DumperOptions(); dumperOptions.setIndent(2); dumperOptions.setDefaultFlowStyle(FlowStyle.BLOCK); dumperOptions.setAllowReadOnlyProperties(true); return new Yaml(constructor, representer, dumperOptions); }
representer.addClassTag(Resource.class, new Tag("!config")); Yaml yaml = new Yaml(new Constructor(Resource.class), representer); try {