@Override protected NodeTuple representJavaBeanProperty(Object bean, Property property, Object value, Tag customTag) { NodeTuple tuple = super.representJavaBeanProperty(bean, property, value, customTag); if (isNullValue(tuple) || isEmptySequence(tuple) || isEmptyMapping(tuple)) { return null; } return tuple; }
@Override protected Node representMapping(Tag tag, Map<?, ?> mapping, Boolean flowStyle) { return super.representMapping(tag, sort(mapping), flowStyle); }
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; } }
TapeRepresenter() { setPropertyUtils(new TapePropertyUtils()); representers.put(URI.class, new RepresentURI()); }
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; } }
TapeRepresenter() { setPropertyUtils(new TapePropertyUtils()); representers.put(URI.class, new RepresentURI()); }
@Override protected NodeTuple representJavaBeanProperty(Object bean, Property property, Object value, Tag customTag) { NodeTuple tuple = super.representJavaBeanProperty(bean, property, value, customTag); if (isNullValue(tuple) || isEmptySequence(tuple) || isEmptyMapping(tuple)) { return null; } return tuple; }
@Override protected Node representMapping(Tag tag, Map<?, ?> mapping, Boolean flowStyle) { return super.representMapping(tag, sort(mapping), flowStyle); }