Этот код выведет: (yaml) < /p>
---
!!org.test.bean.Person
address: 4011 16th Ave S
< /code>
может скрыть мой тип бобов (org.test.bean.Person< /code>) во всяком случае?
(предпочитаю использовать конфигурацию Snakeyaml ... Я не могу его найти ..) < /p>
public static void dumpYAML(){
Constructor constructor = new Constructor(Person.class);
TypeDescription personDescription = new TypeDescription(Person.class);
personDescription.putListPropertyType("phone", Tel.class);
constructor.addTypeDescription(personDescription);
Yaml yaml = new Yaml(constructor);
Person person = (Person) yaml.load(makeYAML());
DumperOptions options = new DumperOptions();
options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
options.setCanonical(false); // display bean member attribute
options.setExplicitStart(true); // display --- start
yaml = new Yaml(options);
String output = yaml.dump(person);
System.out.println(output);
}
Подробнее здесь: https://stackoverflow.com/questions/192 ... -snakeyaml