mirror of
https://github.com/lightbend/config.git
synced 2025-01-15 23:01:05 +08:00
some minor docs tweaks
This commit is contained in:
parent
0cb0a8e072
commit
456535327e
@ -21,7 +21,7 @@ import java.util.Set;
|
||||
* is a key in a JSON object; it's just a string that's the key in a map. A
|
||||
* "path" is a parseable expression with a syntax and it refers to a series of
|
||||
* keys. Path expressions are described in the <a
|
||||
* href="https://github.com/havocp/config/blob/master/HOCON.md">spec for
|
||||
* href="https://github.com/typesafehub/config/blob/master/HOCON.md">spec for
|
||||
* Human-Optimized Config Object Notation</a>. In brief, a path is
|
||||
* period-separated so "a.b.c" looks for key c in object b in object a in the
|
||||
* root object. Sometimes double quotes are needed around special characters in
|
||||
@ -97,7 +97,7 @@ public interface Config extends ConfigMergeable {
|
||||
/**
|
||||
* Returns a replacement config with all substitutions (the
|
||||
* <code>${foo.bar}</code> syntax, see <a
|
||||
* href="https://github.com/havocp/config/blob/master/HOCON.md">the
|
||||
* href="https://github.com/typesafehub/config/blob/master/HOCON.md">the
|
||||
* spec</a>) resolved. Substitutions are looked up using this
|
||||
* <code>Config</code> as the root object, that is, a substitution
|
||||
* <code>${foo.bar}</code> will be replaced with the result of
|
||||
@ -395,7 +395,8 @@ public interface Config extends ConfigMergeable {
|
||||
* Gets a value as a size in bytes (parses special strings like "128M"). If
|
||||
* the value is already a number, then it's left alone; if it's a string,
|
||||
* it's parsed understanding unit suffixes such as "128K", as documented in
|
||||
* the <a href="https://github.com/havocp/config/blob/master/HOCON.md">the
|
||||
* the <a
|
||||
* href="https://github.com/typesafehub/config/blob/master/HOCON.md">the
|
||||
* spec</a>.
|
||||
*
|
||||
* @param path
|
||||
@ -414,9 +415,9 @@ public interface Config extends ConfigMergeable {
|
||||
* Get value as a duration in milliseconds. If the value is already a
|
||||
* number, then it's left alone; if it's a string, it's parsed understanding
|
||||
* units suffixes like "10m" or "5ns" as documented in the <a
|
||||
* href="https://github.com/havocp/config/blob/master/HOCON.md">the
|
||||
* href="https://github.com/typesafehub/config/blob/master/HOCON.md">the
|
||||
* spec</a>.
|
||||
*
|
||||
*
|
||||
* @param path
|
||||
* path expression
|
||||
* @return the duration value at the requested path, in milliseconds
|
||||
|
@ -5,7 +5,8 @@ package com.typesafe.config;
|
||||
|
||||
|
||||
/**
|
||||
* All exceptions thrown by the library are subclasses of ConfigException.
|
||||
* All exceptions thrown by the library are subclasses of
|
||||
* <code>ConfigException</code>.
|
||||
*/
|
||||
public abstract class ConfigException extends RuntimeException {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
@ -295,18 +295,18 @@ public final class ConfigFactory {
|
||||
/**
|
||||
* Converts a Java {@link java.util.Properties} object to a
|
||||
* {@link ConfigObject} using the rules documented in the <a
|
||||
* href="https://github.com/havocp/config/blob/master/HOCON.md">HOCON
|
||||
* href="https://github.com/typesafehub/config/blob/master/HOCON.md">HOCON
|
||||
* spec</a>. The keys in the <code>Properties</code> object are split on the
|
||||
* period character '.' and treated as paths. The values will all end up as
|
||||
* string values. If you have both "a=foo" and "a.b=bar" in your properties
|
||||
* file, so "a" is both the object containing "b" and the string "foo", then
|
||||
* the string value is dropped.
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* If you want to have <code>System.getProperties()</code> as a
|
||||
* ConfigObject, it's better to use the {@link #systemProperties()} method
|
||||
* which returns a cached global singleton.
|
||||
*
|
||||
*
|
||||
* @param properties
|
||||
* a Java Properties object
|
||||
* @param options
|
||||
|
@ -24,19 +24,19 @@ public interface ConfigMergeable {
|
||||
* method (they need to merge the fallback keys into themselves). All other
|
||||
* values just return the original value, since they automatically override
|
||||
* any fallback.
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* The semantics of merging are described in the <a
|
||||
* href="https://github.com/havocp/config/blob/master/HOCON.md">spec for
|
||||
* HOCON</a>.
|
||||
*
|
||||
* href="https://github.com/typesafehub/config/blob/master/HOCON.md">spec
|
||||
* for HOCON</a>.
|
||||
*
|
||||
* <p>
|
||||
* Note that objects do not merge "across" non-objects; if you write
|
||||
* <code>object.withFallback(nonObject).withFallback(otherObject)</code>,
|
||||
* then <code>otherObject</code> will simply be ignored. This is an
|
||||
* intentional part of how merging works. Both non-objects, and any object
|
||||
* which has fallen back to a non-object, block subsequent fallbacks.
|
||||
*
|
||||
*
|
||||
* @param other
|
||||
* an object whose keys should be used if the keys are not
|
||||
* present in this one
|
||||
|
@ -8,38 +8,38 @@ import java.util.Map;
|
||||
/**
|
||||
* Subtype of {@link ConfigValue} representing an object (dictionary, map)
|
||||
* value, as in JSON's <code>{ "a" : 42 }</code> syntax.
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* {@code ConfigObject} implements {@code java.util.Map<String, ConfigValue>} so
|
||||
* you can use it like a regular Java map. Or call {@link #unwrapped()} to
|
||||
* unwrap the map to a map with plain Java values rather than
|
||||
* {@code ConfigValue}.
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* Like all {@link ConfigValue} subtypes, {@code ConfigObject} is immutable.
|
||||
* This makes it threadsafe and you never have to create "defensive copies." The
|
||||
* mutator methods from {@link java.util.Map} all throw
|
||||
* {@link java.lang.UnsupportedOperationException}.
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* The {@link ConfigValue#valueType} method on an object returns
|
||||
* {@link ConfigValueType#OBJECT}.
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* In most cases you want to use the {@link Config} interface rather than this
|
||||
* one. Call {@link #toConfig()} to convert a {@code ConfigObject} to a
|
||||
* {@code Config}.
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* The API for a {@code ConfigObject} is in terms of keys, while the API for a
|
||||
* {@link Config} is in terms of path expressions. Conceptually,
|
||||
* {@code ConfigObject} is a tree of maps from keys to values, while a
|
||||
* {@code ConfigObject} is a one-level map from paths to values.
|
||||
*
|
||||
* {@code Config} is a one-level map from paths to values.
|
||||
*
|
||||
* <p>
|
||||
* Use {@link ConfigUtil#joinPath} and {@link ConfigUtil#splitPath} to convert
|
||||
* between path expressions and individual path elements (keys).
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* A {@code ConfigObject} may contain null values, which will have
|
||||
* {@link ConfigValue#valueType()} equal to {@link ConfigValueType#NULL}. If
|
||||
@ -47,7 +47,7 @@ import java.util.Map;
|
||||
* file (or wherever this value tree came from). If {@code get()} returns a
|
||||
* {@link ConfigValue} with type {@code ConfigValueType#NULL} then the key was
|
||||
* set to null explicitly in the config file.
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* <em>Do not implement {@code ConfigObject}</em>; it should only be implemented
|
||||
* by the config library. Arbitrary implementations will not work because the
|
||||
|
@ -6,11 +6,13 @@ package com.typesafe.config;
|
||||
/**
|
||||
* A set of options related to resolving substitutions. Substitutions use the
|
||||
* <code>${foo.bar}</code> syntax and are documented in the <a
|
||||
* href="https://github.com/havocp/config/blob/master/HOCON.md">HOCON</a> spec.
|
||||
* href="https://github.com/typesafehub/config/blob/master/HOCON.md">HOCON</a>
|
||||
* spec.
|
||||
* <p>
|
||||
* This object is immutable, so the "setters" return a new object.
|
||||
* <p>
|
||||
* Here is an example of creating a custom {@code ConfigResolveOptions}:
|
||||
*
|
||||
* <pre>
|
||||
* ConfigResolveOptions options = ConfigResolveOptions.defaults()
|
||||
* .setUseSystemEnvironment(false)
|
||||
|
@ -5,8 +5,8 @@ package com.typesafe.config;
|
||||
|
||||
/**
|
||||
* The syntax of a character stream, <a href="http://json.org">JSON</a>, <a
|
||||
* href="https://github.com/havocp/config/blob/master/HOCON.md">HOCON</a> aka
|
||||
* ".conf", or <a href=
|
||||
* href="https://github.com/typesafehub/config/blob/master/HOCON.md">HOCON</a>
|
||||
* aka ".conf", or <a href=
|
||||
* "http://download.oracle.com/javase/7/docs/api/java/util/Properties.html#load%28java.io.Reader%29"
|
||||
* >Java properties</a>.
|
||||
*
|
||||
@ -19,8 +19,8 @@ public enum ConfigSyntax {
|
||||
JSON,
|
||||
/**
|
||||
* The JSON-superset <a
|
||||
* href="https://github.com/havocp/config/blob/master/HOCON.md">HOCON</a>
|
||||
* format.
|
||||
* href="https://github.com/typesafehub/config/blob/master/HOCON.md"
|
||||
* >HOCON</a> format.
|
||||
*/
|
||||
CONF,
|
||||
/**
|
||||
|
@ -8,9 +8,9 @@ import java.util.Map;
|
||||
import com.typesafe.config.impl.ConfigImpl;
|
||||
|
||||
/**
|
||||
* This class holds some static factory methods for building ConfigValue. See
|
||||
* also ConfigFactory which has methods for parsing files and certain in-memory
|
||||
* data structures.
|
||||
* This class holds some static factory methods for building {@link ConfigValue}
|
||||
* instances. See also {@link ConfigFactory} which has methods for parsing files
|
||||
* and certain in-memory data structures.
|
||||
*/
|
||||
public final class ConfigValueFactory {
|
||||
private ConfigValueFactory() {
|
||||
|
Loading…
Reference in New Issue
Block a user