public final class YamlMethods extends Object
| Constructor and Description |
|---|
YamlMethods() |
| Modifier and Type | Method and Description |
|---|---|
static String |
asYaml(GloopObject gloopObject,
boolean includeRoot,
boolean includeNulls)
Marshals a Gloop object to a YAML string.
|
static GloopCursor |
getInputCursorFromFile(String filename,
List<String> yamlNodeNames,
GloopExecutionContext context)
Return a Gloop input cursor for reading the entries of a large YAML file.
|
static GloopCursor |
getInputCursorFromInputStream(InputStream inputStream,
List<String> yamlNodeNames,
GloopExecutionContext context)
Return a Gloop input cursor for reading the entries of a large YAML stream.
|
static String |
gloopModelToYamlString(GloopObject gloopObject)
Marshals a Gloop object to a YAML string.
|
static GloopObject |
inputStreamToGloopObject(InputStream yamlStream)
Unmarshal a YAML stream to a Gloop object.
|
static GloopModel |
openYamlOutputCursor(boolean printStartDocument,
String name,
String indent,
boolean closeDestination,
Object destination,
GloopExecutionContext context)
Return a Gloop output cursor for writing a large amount of YAML data.
|
static void |
printYaml(groovy.util.IndentPrinter printer,
GloopObject gloopObject,
boolean includeNulls)
Marshals a Gloop object to a YAML string.
|
static GloopObject |
readerToGloopObject(Reader yamlString)
Unmarshal a YAML string from a
Reader to a Gloop object. |
static void |
writeYaml(Writer writer,
GloopObject gloopObject,
boolean includeNulls)
Marshals a Gloop object to a YAML string.
|
static GloopObject |
yamlStringToGloopObject(String yamlString)
Unmarshal a YAML string to a Gloop object.
|
@GloopParameter(name="gloopYaml") public static String gloopModelToYamlString(GloopObject gloopObject)
Marshals a Gloop object to a YAML string.
gloopObject - the object to marshallpublic static GloopObject yamlStringToGloopObject(String yamlString)
Unmarshal a YAML string to a Gloop object.
yamlString - YAML to convertpublic static GloopObject inputStreamToGloopObject(InputStream yamlStream)
Unmarshal a YAML stream to a Gloop object.
yamlStream - YAML to convertpublic static 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) 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) 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) 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 GloopCursor getInputCursorFromFile(String filename, List<String> yamlNodeNames, 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 GloopCursor getInputCursorFromInputStream(InputStream inputStream, List<String> yamlNodeNames, 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 GloopModel openYamlOutputCursor(@GloopParameter(defaultValue="true") boolean printStartDocument, String name, @GloopParameter(allowNull=false,defaultValue=" ") String indent, @GloopParameter(defaultValue="true") boolean closeDestination, Object destination, 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 Filecontext - the Gloop execution context (automatically mapped by Gloop)IOExceptionCopyright © 2021. All rights reserved.