public class Yamls
extends java.lang.Object
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 object (map or list or primitive) as the given yaml-supperted type
(map or list or primitive e.g.
|
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 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 containing a single element, and the type is not an iterable, this will attempt to unwrap it.
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 casted@Beta public static java.lang.Object getAt(java.lang.String yaml, java.util.List<java.lang.String> path)
#getAt(Object, List)
@Beta 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)