Package org.geotools.ysld
Class YamlObject<T>
- Object
-
- YamlObject<T>
-
public class YamlObject<T> extends Object
Base class for Yaml object wrappers.Yaml is represented as atomic types (literals, expressions) and YamlObjects (for wrapping lists and maps). The factory method
create(Object)
will sort out the details. These YamlObjects are used to stage data when parsing a Yaml document.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
YamlObject(T raw)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected <C> C
convert(Object obj, Class<C> clazz)
Converts an object to the specified class.static <W> YamlObject<W>
create(W raw)
Convert raw object to Yaml wrapper.Object
lookup(String path)
Raw value access via path.Object
lookupY(String path)
YamlMap
map()
Casts this object to aYamlMap
.T
raw()
Returns the raw object.YamlSeq
seq()
Casts this object to aYamlSeq
.String
toString()
Yaml representation.
-
-
-
Field Detail
-
raw
protected T raw
underlying raw object
-
-
Constructor Detail
-
YamlObject
protected YamlObject(T raw)
-
-
Method Detail
-
create
public static <W> YamlObject<W> create(W raw)
Convert raw object to Yaml wrapper.- Returns:
- Yaml object wrapper, or null if the provided raw object is null.
-
lookup
public Object lookup(String path)
Raw value access via path.Indended for quick value lookup during test cases.
- raw("1"): first value in a sequence
- raw("x"): value for "x" in a map
- raw("rules/2/symbolizers/3"): third symbolizer in second rule
- Returns:
- raw value, or null if not available
-
raw
public T raw()
Returns the raw object.
-
lookupY
public Object lookupY(String path)
Seelookup(java.lang.String)
. Ensures that the result is wrapped as a YamlObject if it is a map, list, or array.
-
convert
protected <C> C convert(Object obj, Class<C> clazz)
Converts an object to the specified class.
-
-