public class Yaml extends 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(String apiGroupVersion,
String kind,
Class<?> clazz)
Add a mapping from API Group/version/kind to a Class to use when calling
load(...)
. |
static String |
dump(Object object)
Takes an API object and returns a YAML String representing that object.
|
static void |
dump(Object object,
Writer writer)
Takes an API object and writes a YAML string representing that object to the writer.
|
static String |
dumpAll(Iterator<? extends Object> data)
Takes an Iterator of YAML API objects and returns a YAML string representing all of them
|
static void |
dumpAll(Iterator<? extends Object> data,
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 Object |
load(File f)
Load an API object from a YAML file.
|
static Object |
load(Reader reader)
Load an API object from a stream of data.
|
static Object |
load(String content)
Load an API object from a YAML string representation.
|
static List<Object> |
loadAll(File f)
Load list of instantiated API objects from a YAML file.
|
static List<Object> |
loadAll(Reader reader)
Load list of instantiated API objects from a stream of data.
|
static List<Object> |
loadAll(String content)
Load list of instantiated API objects from a YAML string representation.
|
static <T> T |
loadAs(File f,
Class<T> clazz)
Load an API object from a YAML file.
|
static <T> T |
loadAs(Reader reader,
Class<T> clazz)
Load an API object from a YAML stream.
|
static <T> T |
loadAs(String content,
Class<T> clazz)
Load an API object from a YAML string representation.
|
public static void addModelMap(String apiGroupVersion, String kind, Class<?> clazz)
load(...)
.
Shouldn't really be needed as most API Group/Version/Kind are loaded dynamically at startup.
public static Object load(String content) throws IOException
content
- The YAML contentIOException
- If an error occurs while reading the YAML.public static Object load(File f) throws IOException
f
- The file to load.IOException
- If an error occurs while reading the YAML.public static Object load(Reader reader) throws IOException
reader
- The stream to load.IOException
- If an error occurs while reading the YAML.public static <T> T loadAs(String content, Class<T> clazz)
content
- The YAML contentclazz
- The class of object to return.IOException
- If an error occurs while reading the YAML.public static <T> T loadAs(File f, Class<T> clazz) throws IOException
f
- The YAML fileclazz
- The class of object to return.IOException
- If an error occurs while reading the YAML.public static <T> T loadAs(Reader reader, Class<T> clazz)
reader
- The YAML streamclazz
- The class of object to return.IOException
- If an error occurs while reading the YAML.public static List<Object> loadAll(String content) throws IOException
Order of API objects in list will be preserved according to order of objects in YAML string.
content
- The YAML contentIOException
- If an error occurs while reading the YAML.public static List<Object> loadAll(File f) throws IOException
Order of API objects in list will be preserved according to order of objects in YAML file.
f
- The file to load.IOException
- If an error occurs while reading the YAML.public static List<Object> loadAll(Reader reader) throws IOException
Order of API objects in list will be preserved according to order of objects in stream of data.
reader
- The stream to load.IOException
- If an error occurs while reading the YAML.public static String dump(Object object)
object
- The API object to dump.public static void dump(Object object, Writer writer)
object
- The API object to dumpwriter
- The writer to write the YAML to.public static String dumpAll(Iterator<? extends Object> data)
data
- The list of YAML API objectspublic static void dumpAll(Iterator<? extends Object> data, 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 © 2020. All rights reserved.