public class Yaml
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Yaml.CustomConstructor
Defines constructor logic for custom types in this library.
|
static class |
Yaml.CustomRepresenter |
Constructor and Description |
---|
Yaml() |
Modifier and Type | Method and Description |
---|---|
static void |
addModelMap(java.lang.String apiGroupVersion,
java.lang.String kind,
java.lang.Class<?> clazz)
Add a mapping from API Group/version/kind to a Class to use when calling
load(...)
. |
static java.lang.String |
dump(java.lang.Object object)
Takes an API object and returns a YAML String representing that object.
|
static void |
dump(java.lang.Object object,
java.io.Writer writer)
Takes an API object and writes a YAML string representing that object to the writer.
|
static java.lang.String |
dumpAll(java.util.Iterator<? extends java.lang.Object> data)
Takes an Iterator of YAML API objects and returns a YAML string representing all of them
|
static void |
dumpAll(java.util.Iterator<? extends java.lang.Object> data,
java.io.Writer output)
Takes an Iterator of YAML API objects and writes a YAML String representing all of them.
|
static org.yaml.snakeyaml.Yaml |
getSnakeYaml() |
static java.lang.Object |
load(java.io.File f)
Load an API object from a YAML file.
|
static java.lang.Object |
load(java.io.Reader reader)
Load an API object from a stream of data.
|
static java.lang.Object |
load(java.lang.String content)
Load an API object from a YAML string representation.
|
static java.util.List<java.lang.Object> |
loadAll(java.io.File f)
Load list of instantiated API objects from a YAML file.
|
static java.util.List<java.lang.Object> |
loadAll(java.io.Reader reader)
Load list of instantiated API objects from a stream of data.
|
static java.util.List<java.lang.Object> |
loadAll(java.lang.String content)
Load list of instantiated API objects from a YAML string representation.
|
static <T> T |
loadAs(java.io.File f,
java.lang.Class<T> clazz)
Load an API object from a YAML file.
|
static <T> T |
loadAs(java.io.Reader reader,
java.lang.Class<T> clazz)
Load an API object from a YAML stream.
|
static <T> T |
loadAs(java.lang.String content,
java.lang.Class<T> clazz)
Load an API object from a YAML string representation.
|
public static void addModelMap(java.lang.String apiGroupVersion, java.lang.String kind, java.lang.Class<?> clazz)
load(...)
.
Shouldn't really be needed as most API Group/Version/Kind are loaded dynamically at startup.
public static java.lang.Object load(java.lang.String content) throws java.io.IOException
content
- The YAML contentjava.io.IOException
- If an error occurs while reading the YAML.public static java.lang.Object load(java.io.File f) throws java.io.IOException
f
- The file to load.java.io.IOException
- If an error occurs while reading the YAML.public static java.lang.Object load(java.io.Reader reader) throws java.io.IOException
reader
- The stream to load.java.io.IOException
- If an error occurs while reading the YAML.public static <T> T loadAs(java.lang.String content, java.lang.Class<T> clazz)
content
- The YAML contentclazz
- The class of object to return.java.io.IOException
- If an error occurs while reading the YAML.public static <T> T loadAs(java.io.File f, java.lang.Class<T> clazz) throws java.io.IOException
f
- The YAML fileclazz
- The class of object to return.java.io.IOException
- If an error occurs while reading the YAML.public static <T> T loadAs(java.io.Reader reader, java.lang.Class<T> clazz)
reader
- The YAML streamclazz
- The class of object to return.java.io.IOException
- If an error occurs while reading the YAML.public static java.util.List<java.lang.Object> loadAll(java.lang.String content) throws java.io.IOException
Order of API objects in list will be preserved according to order of objects in YAML string.
content
- The YAML contentjava.io.IOException
- If an error occurs while reading the YAML.public static java.util.List<java.lang.Object> loadAll(java.io.File f) throws java.io.IOException
Order of API objects in list will be preserved according to order of objects in YAML file.
f
- The file to load.java.io.IOException
- If an error occurs while reading the YAML.public static java.util.List<java.lang.Object> loadAll(java.io.Reader reader) throws java.io.IOException
Order of API objects in list will be preserved according to order of objects in stream of data.
reader
- The stream to load.java.io.IOException
- If an error occurs while reading the YAML.public static java.lang.String dump(java.lang.Object object)
object
- The API object to dump.public static void dump(java.lang.Object object, java.io.Writer writer)
object
- The API object to dumpwriter
- The writer to write the YAML to.public static java.lang.String dumpAll(java.util.Iterator<? extends java.lang.Object> data)
data
- The list of YAML API objectspublic static void dumpAll(java.util.Iterator<? extends java.lang.Object> data, java.io.Writer output)
data
- The list of YAML API objects.output
- The writer to output the YAML String to.public static org.yaml.snakeyaml.Yaml getSnakeYaml()
Copyright © 2019. All rights reserved.