public class Yamls
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Yamls.YamlExtract |
Constructor and Description |
---|
Yamls() |
Modifier and Type | Method and Description |
---|---|
static void |
dump(int depth,
java.lang.Object r) |
static <T> T |
getAs(java.lang.Object x,
java.lang.Class<T> type)
returns the given (yaml-parsed) object as the given yaml type.
|
static java.lang.Object |
getAt(java.lang.String yaml,
java.util.List<java.lang.String> path)
Parses the given yaml, and walks the given path to return the referenced object.
|
static java.lang.Object |
getAtPreParsed(java.lang.Object current,
java.util.List<java.lang.String> path)
For pre-parsed yaml, walks the maps/lists to return the given sub-item.
|
static java.lang.Object |
getMultinameAttribute(java.util.Map<java.lang.String,java.lang.Object> obj,
java.lang.String... equivalentNames) |
static Yamls.YamlExtract |
getTextOfYamlAtPath(java.lang.String yaml,
java.lang.Object... path)
Given a path, where each segment consists of a string (key) or number (element in list),
this will find the YAML text for that element
|
static java.lang.Iterable<java.lang.Object> |
parseAll(java.io.Reader yaml)
|
static java.lang.Iterable<java.lang.Object> |
parseAll(java.lang.String yaml)
simplifies new Yaml().loadAll, and converts to list to prevent single-use iterable bug in yaml
|
static java.lang.Object |
removeMultinameAttribute(java.util.Map<java.lang.String,java.lang.Object> obj,
java.lang.String... equivalentNames) |
public static <T> T getAs(java.lang.Object x, java.lang.Class<T> type)
if the object is an iterable or iterator this method will fully expand it as a list. if the requested type is not an iterable or iterator, and the list contains a single item, this will take that single item.
in other cases this method simply does a type-check and cast (no other type coercion).
java.lang.IllegalArgumentException
- if the input is an iterable not containing a single element,
and the cast is requested to a non-iterable typejava.lang.ClassCastException
- if cannot be castedpublic static java.lang.Object getAt(java.lang.String yaml, java.util.List<java.lang.String> path)
#getAt(Object, List)
public static java.lang.Object getAtPreParsed(java.lang.Object current, java.util.List<java.lang.String> path)
Jsonya
, such as Jsonya.of(current).at(path).get()
.null
if that path does not exist.public static void dump(int depth, java.lang.Object r)
public static java.lang.Iterable<java.lang.Object> parseAll(java.lang.String yaml)
public static java.lang.Iterable<java.lang.Object> parseAll(java.io.Reader yaml)
public static java.lang.Object removeMultinameAttribute(java.util.Map<java.lang.String,java.lang.Object> obj, java.lang.String... equivalentNames)
public static java.lang.Object getMultinameAttribute(java.util.Map<java.lang.String,java.lang.Object> obj, java.lang.String... equivalentNames)
public static Yamls.YamlExtract getTextOfYamlAtPath(java.lang.String yaml, java.lang.Object... path)
If not found this will return a Yamls.YamlExtract
where YamlExtract#isMatch()
is false and Yamls.YamlExtract.getError()
is set.