https://code.google.com/p/yamlbeans/
Here's a quick example:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.... | |
import com.esotericsoftware.yamlbeans.YamlWriter; | |
public class GenYaml { | |
public static void main(String args[]) throws IOException | |
{ | |
ArrayList<MyModel> l = new ArrayList<MyModel>(); | |
YamlWriter writer = new YamlWriter(new FileWriter("MyModel-test.yml")); | |
for(int i=0; i < 20; i++) | |
{ | |
MyModel t = new MyModel( | |
add, | |
whatever, | |
data, | |
you, | |
need | |
); | |
l.add(t); | |
} | |
writer.write(l); | |
writer.close(); | |
} | |
} |
I did find that I had to modify the output a tad (adding bangs here or there), but for the most part... it's pretty good.
No comments:
Post a Comment