Clarified Usage and added TODO

This commit is contained in:
moandji.ezana 2013-02-26 21:57:29 +02:00
parent 58224344f0
commit 3dda0b7701

View file

@ -30,11 +30,15 @@ Add the following dependency:
## Usage ## Usage
1. Create a com.moandjiezana.toml.Toml4J instance
1. Call the `parse` method of your choice
1. Use the getters to retrieve the data
````java ````java
Toml toml = new Toml().parse(getTomlFile()); // throws an Exception if the TOML is incorrect Toml toml = new Toml().parse(getTomlFile()); // throws an Exception if the TOML is incorrect
String title = toml.getString("title"); // if a key doesn't exist, returns null String title = toml.getString("title"); // if a key doesn't exist, returns null
Boolean enabled = toml.getBoolean("database.enabled"); // gets the key enabled from the key group database Boolean enabled = toml.getBoolean("database.enabled"); // gets the value of enabled from the database key group
Toml servers = toml.getKeyGroup("servers"); // returns a new Toml instance containing only the key group's values Toml servers = toml.getKeyGroup("servers"); // returns a new Toml instance containing only the key group's values
```` ````
@ -51,8 +55,12 @@ Long b = toml.getLong("b"); // returns 3
Long c = toml.getLong("c"); // returns null Long c = toml.getLong("c"); // returns null
```` ````
## TODO
* Support all special characters
* Convert Toml to custom class
## License ## License
toml4j is copyright of Moandji Ezana toml4j is copyright of Moandji Ezana and is licensed under the [MIT License](http://www.opensource.org/licenses/mit-license.php)
toml4j is licensed under the [MIT License](http://www.opensource.org/licenses/mit-license.php)