{ "a" : 42 }
syntax. An object may also be viewed as a {@link Config} by calling{@link ConfigObject#toConfig()}.
{@code ConfigObject} implements {@code java.util.Map 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}. The {@link ConfigValue#valueType} method on an object returns{@link ConfigValueType#OBJECT}. In most cases you want to use the {@link Config} interface rather than thisone. Call {@link #toConfig()} to convert a {@code ConfigObject} to a{@code Config}. 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 Config} is a one-level map from paths to values. Use {@link ConfigUtil#joinPath} and {@link ConfigUtil#splitPath} to convertbetween path expressions and individual path elements (keys). A {@code ConfigObject} may contain null values, which will have{@link ConfigValue#valueType()} equal to {@link ConfigValueType#NULL}. If {@link ConfigObject#get(Object)} returns Java's null then the key was notpresent in the parsed file (or wherever this value tree came from). If {@code get("key")} returns a {@link ConfigValue} with type{@code ConfigValueType#NULL} then the key was set to null explicitly in theconfig file. Do not implement interface {@code ConfigObject}; it should only be implemented by the config library. Arbitrary implementations will not work because the library internals assume a specific concrete implementation. Also, this interface is likely to grow new methods over time, so third-party implementations will break.
|
|
|
|