mirror of
https://github.com/plexusorg/toml4j.git
synced 2024-12-29 11:42:15 +00:00
Javadoc improvements
This commit is contained in:
parent
cdef758f4c
commit
be85328555
1 changed files with 20 additions and 10 deletions
|
@ -8,9 +8,6 @@ import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.math.BigInteger;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
@ -28,6 +25,8 @@ import com.google.gson.JsonElement;
|
||||||
* <p>All getters can fall back to default values if they have been provided as a constructor argument.
|
* <p>All getters can fall back to default values if they have been provided as a constructor argument.
|
||||||
* Getters for simple values (String, Date, etc.) will return null if no matching key exists.
|
* Getters for simple values (String, Date, etc.) will return null if no matching key exists.
|
||||||
* {@link #getList(String)}, {@link #getTable(String)} and {@link #getTables(String)} return empty values if there is no matching key.</p>
|
* {@link #getList(String)}, {@link #getTable(String)} and {@link #getTables(String)} return empty values if there is no matching key.</p>
|
||||||
|
*
|
||||||
|
* <p>All parse methods throw an {@link IllegalStateException} if the TOML is incorrect.</p>
|
||||||
*
|
*
|
||||||
* <p>Example usage:</p>
|
* <p>Example usage:</p>
|
||||||
* <pre><code>
|
* <pre><code>
|
||||||
|
@ -141,6 +140,11 @@ public class Toml {
|
||||||
return (Long) get(key);
|
return (Long) get(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param key a TOML key
|
||||||
|
* @param <T> type of list items
|
||||||
|
* @return an empty {@link List} is the key is not found
|
||||||
|
*/
|
||||||
public <T> List<T> getList(String key) {
|
public <T> List<T> getList(String key) {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
List<T> list = (List<T>) get(key);
|
List<T> list = (List<T>) get(key);
|
||||||
|
@ -175,7 +179,7 @@ public class Toml {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param key Name of array of tables, not including square brackets.
|
* @param key Name of array of tables, not including square brackets.
|
||||||
* @return An empty List if no value is found for key.
|
* @return An empty {@link List} if no value is found for key.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public List<Toml> getTables(String key) {
|
public List<Toml> getTables(String key) {
|
||||||
|
@ -195,18 +199,24 @@ public class Toml {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Populates an instance of targetClass with the values of this Toml instance.
|
* <p>
|
||||||
* The target's field names must match keys or tables.
|
* Populates an instance of targetClass with the values of this Toml instance.
|
||||||
* Keys not present in targetClass will be ignored.</p>
|
* The target's field names must match keys or tables.
|
||||||
|
* Keys not present in targetClass will be ignored.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* <p>Tables are recursively converted to custom classes or to {@link Map Map<String, Object>}.</p>
|
* <p>Tables are recursively converted to custom classes or to {@link Map Map<String, Object>}.</p>
|
||||||
*
|
*
|
||||||
* <p>In addition to straight-forward conversion of TOML primitives, the following are also available:</p>
|
* <p>In addition to straight-forward conversion of TOML primitives, the following are also available:</p>
|
||||||
*
|
*
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>TOML string to {@link Character}, {@link URL} or enum</li>
|
* <li>Integer -> int, long (or wrapper), {@link java.math.BigInteger}</li>
|
||||||
* <li>TOML number to any primitive (or wrapper), {@link BigInteger} or {@link BigDecimal}</li>
|
* <li>Float -> float, double (or wrapper), {@link java.math.BigDecimal}</li>
|
||||||
* <li>TOML array to {@link Set}</li>
|
* <li>One-letter String -> char, {@link Character}</li>
|
||||||
|
* <li>String -> {@link String}, enum, {@link java.net.URI}, {@link java.net.URL}</li>
|
||||||
|
* <li>Multiline and Literal Strings -> {@link String}</li>
|
||||||
|
* <li>Array -> {@link List}, {@link Set}, array. The generic type can be anything that can be converted.</li>
|
||||||
|
* <li>Table -> Custom class, {@link Map Map<String, Object>}</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*
|
*
|
||||||
* @param targetClass Class to deserialize TOML to.
|
* @param targetClass Class to deserialize TOML to.
|
||||||
|
|
Loading…
Reference in a new issue