public final class YamlMethods extends Object
Constructor and Description |
---|
YamlMethods() |
Modifier and Type | Method and Description |
---|---|
static String |
asYaml(io.toro.gloop.object.property.GloopObject gloopObject,
boolean includeRoot,
boolean includeNulls)
Marshals a Gloop object to a YAML string.
|
static io.toro.gloop.object.cursor.GloopCursor |
getInputCursorFromFile(String filename,
List<String> yamlNodeNames,
io.toro.gloop.engine.GloopExecutionContext context)
Return a Gloop input cursor for reading the entries of a large YAML file.
|
static io.toro.gloop.object.cursor.GloopCursor |
getInputCursorFromInputStream(InputStream inputStream,
List<String> yamlNodeNames,
io.toro.gloop.engine.GloopExecutionContext context)
Return a Gloop input cursor for reading the entries of a large YAML stream.
|
static String |
gloopModelToYamlString(io.toro.gloop.object.property.GloopObject gloopObject)
Marshals a Gloop object to a YAML string.
|
static io.toro.gloop.object.property.GloopObject |
inputStreamToGloopObject(InputStream yamlStream)
Unmarshal a YAML stream to a Gloop object.
|
static io.toro.gloop.object.property.GloopModel |
openYamlOutputCursor(boolean printStartDocument,
String name,
String indent,
boolean closeDestination,
Object destination,
io.toro.gloop.engine.GloopExecutionContext context)
Return a Gloop output cursor for writing a large amount of YAML data.
|
static void |
printYaml(groovy.util.IndentPrinter printer,
io.toro.gloop.object.property.GloopObject gloopObject,
boolean includeNulls)
Marshals a Gloop object to a YAML string.
|
static io.toro.gloop.object.property.GloopObject |
readerToGloopObject(Reader yamlString)
Unmarshal a YAML string from a
Reader to a Gloop object. |
static void |
writeYaml(Writer writer,
io.toro.gloop.object.property.GloopObject gloopObject,
boolean includeNulls)
Marshals a Gloop object to a YAML string.
|
static io.toro.gloop.object.property.GloopObject |
yamlStringToGloopObject(String yamlString)
Unmarshal a YAML string to a Gloop object.
|
@GloopParameter(name="gloopYaml") public static String gloopModelToYamlString(io.toro.gloop.object.property.GloopObject gloopObject)
Marshals a Gloop object to a YAML string.
gloopObject
- the object to marshallpublic static io.toro.gloop.object.property.GloopObject yamlStringToGloopObject(String yamlString)
Unmarshal a YAML string to a Gloop object.
yamlString
- YAML to convertpublic static io.toro.gloop.object.property.GloopObject inputStreamToGloopObject(InputStream yamlStream)
Unmarshal a YAML stream to a Gloop object.
yamlStream
- YAML to convertpublic static io.toro.gloop.object.property.GloopObject readerToGloopObject(Reader yamlString)
Unmarshal a YAML string from a Reader
to a Gloop object.
yamlString
- reader containing the YAML to convertpublic static String asYaml(@GloopParameter(allowNull=false) io.toro.gloop.object.property.GloopObject gloopObject, @GloopParameter(defaultValue="false") boolean includeRoot, @GloopParameter(defaultValue="false") boolean includeNulls)
Marshals a Gloop object to a YAML string.
gloopObject
- the object to marshalincludeRoot
- whether or not to add a root element for the objectincludeNulls
- whether or not to include null propertiespublic static void writeYaml(@GloopParameter(allowNull=false) Writer writer, @GloopParameter(allowNull=false) io.toro.gloop.object.property.GloopObject gloopObject, @GloopParameter(defaultValue="false") boolean includeNulls)
Marshals a Gloop object to a YAML string.
writer
- where the YAML string will be written togloopObject
- the object to marshalincludeNulls
- whether or not to include null propertiespublic static void printYaml(@GloopParameter(allowNull=false) groovy.util.IndentPrinter printer, @GloopParameter(allowNull=false) io.toro.gloop.object.property.GloopObject gloopObject, @GloopParameter(defaultValue="false") boolean includeNulls)
Marshals a Gloop object to a YAML string.
printer
- where the YAML string will be written togloopObject
- the object to marshalincludeNulls
- whether or not to include null properties@GloopObjectParameter(value="gloopYamlCursor{\n gloopYamlCursor[]{\n nodeName\n cursorRecord:object\n }\n}") public static io.toro.gloop.object.cursor.GloopCursor getInputCursorFromFile(String filename, List<String> yamlNodeNames, io.toro.gloop.engine.GloopExecutionContext context) throws FileNotFoundException
Return a Gloop input cursor for reading the entries of a large YAML file.
Use the yamlNodeNames
property to specify which nodes you want to extract from the YAML file.
Use $yamlRoot for root arrays.
filename
- the name of the large XML file to readyamlNodeNames
- the element names the cursor should be seekingcontext
- the Gloop execution context (automatically mapped by Gloop)yamlNodeNames
parameterFileNotFoundException
- if the file does not exist,
is a directory rather than a regular file,
or for some other reason cannot be opened for reading@GloopObjectParameter(value="gloopYamlCursor{\n gloopYamlCursor[]{\n nodeName\n cursorRecord:object\n }\n}") public static io.toro.gloop.object.cursor.GloopCursor getInputCursorFromInputStream(InputStream inputStream, List<String> yamlNodeNames, io.toro.gloop.engine.GloopExecutionContext context)
Return a Gloop input cursor for reading the entries of a large YAML stream.
Use the yamlNodeNames
property to specify which nodes you want to extract from the YAML stream.
Use $yamlRoot for root arrays.
inputStream
- input stream containing the YAML to readyamlNodeNames
- the element names the cursor should be seekingcontext
- the Gloop execution context (automatically mapped by Gloop)yamlNodeNames
parameter@GloopObjectParameter(value="output{\nyamlCursorOutput{\nindentPrinter:object:printer used to write the yaml out to::::groovy.util.IndentPrinter\nyamlOutputCursor[]*{\n}\n}\n}") public static io.toro.gloop.object.property.GloopModel openYamlOutputCursor(@GloopParameter(defaultValue="true") boolean printStartDocument, String name, @GloopParameter(allowNull=false,defaultValue=" ") String indent, @GloopParameter(defaultValue="true") boolean closeDestination, Object destination, io.toro.gloop.engine.GloopExecutionContext context) throws IOException
Return a Gloop output cursor for writing a large amount of YAML data.
printStartDocument
- set to true if the cursor will print a --- at the start of the documentname
- name to print before declaring the array; should be null if there is no nameindent
- indent to use if pretty printing; default is 2 spacescloseDestination
- set to true if the cursor will close the underlying destination
after printing closing textdestination
- where to write the data to;
must be a StringBuffer
, Writer
, OutputStream
, Path
, or File
context
- the Gloop execution context (automatically mapped by Gloop)IOException
Copyright © 2020. All rights reserved.