Package org.pkl.config.java
Interface Config
-
public interface ConfigA root, intermediate, or leaf node in a configuration tree. Child nodes can be obtained by name usingget(String). To consume the node's composite or scalar value, convert the value to the desired Java type, using one of the providedas(java.lang.Class<T>)methods.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T> Tas(java.lang.Class<T> type)Converts this node's value to the givenClass.<T> Tas(java.lang.reflect.Type type)Converts this node's value to the givenType.<T> Tas(JavaType<T> type)Converts this node's value to the givenJavaType.Configget(java.lang.String childName)Returns the child node with the given unqualified name.java.lang.StringgetQualifiedName()The dot-separated name of this node.java.lang.ObjectgetRawValue()The raw value of this node, as provided byEvaluator.
-
-
-
Method Detail
-
getQualifiedName
java.lang.String getQualifiedName()
The dot-separated name of this node. For example, the node reached usingrootNode.get("foo").get("bar")has qualified namefoo.bar. Returns the empty String for the root node itself.
-
getRawValue
java.lang.Object getRawValue()
The raw value of this node, as provided byEvaluator. Typically, a node's value is not consumed directly, but converted to the desired Java type usingas(java.lang.Class<T>).
-
get
Config get(java.lang.String childName)
Returns the child node with the given unqualified name.- Throws:
NoSuchChildException- if a child with the given name does not exist
-
as
<T> T as(java.lang.Class<T> type)
Converts this node's value to the givenClass.- Throws:
ConversionException- if the value cannot be converted to the given type
-
as
<T> T as(java.lang.reflect.Type type)
Converts this node's value to the givenType.Note that usages of this methods are not type safe.
- Throws:
ConversionException- if the value cannot be converted to the given type
-
as
<T> T as(JavaType<T> type)
Converts this node's value to the givenJavaType.- Throws:
ConversionException- if the value cannot be converted to the given type
-
-