org.parancoe.yaml
Class YamlConfig

java.lang.Object
  extended by org.parancoe.yaml.YamlConfig
All Implemented Interfaces:
java.lang.Cloneable, YamlOperations

public class YamlConfig
extends java.lang.Object
implements YamlOperations, java.lang.Cloneable

YamlConfig represents a Jyaml configuration and contains all methods in YamlOperations and is used as the entry point for Yaml operations when multiple Jyaml configurations are used in the same application. See YamlOperations for documentation on the Yaml entry point methods.


Constructor Summary
YamlConfig()
           
 
Method Summary
 java.lang.Object clone()
           
 java.lang.String dump(java.lang.Object obj)
          Dumps an object into Yaml format
 java.lang.String dump(java.lang.Object obj, boolean minimalOutput)
          Dumps an object into Yaml format
 void dump(java.lang.Object obj, java.io.File file)
          Dumps an object to a file in Yaml format
 void dump(java.lang.Object obj, java.io.File file, boolean minimalOutput)
          Dumps an object to a file in Yaml format
 java.lang.String dumpStream(java.util.Iterator iterator)
          Dumps a stream of objects specified with an iterator to a String in Yaml format, one document per object
 java.lang.String dumpStream(java.util.Iterator iterator, boolean minimalOutput)
          Dumps a stream of objects specified with an iterator to a String in Yaml format, one document per object
 void dumpStream(java.util.Iterator iterator, java.io.File file)
          Dumps a stream of objects specified with an iterator to a file in Yaml format, one document per object
 void dumpStream(java.util.Iterator iterator, java.io.File file, boolean minimalOutput)
          Dumps a stream of objects specified with an iterator to a file in Yaml format, one document per object
static YamlConfig fromFile(java.lang.String filename)
          Loads a YamlConfig from a Yaml configuration file
static YamlConfig fromResource(java.lang.String filename)
          Loads a YamlConfig from a resource on the classpath
static YamlConfig getDefaultConfig()
          The default Jyaml configuration
 java.lang.String getIndentAmount()
          Returns the indentation amount used for one indentation level.
 BiDirectionalMap<java.lang.String,java.lang.String> getTransfers()
          returns the transfer-to-classname mapping for this configuration
 boolean isMinimalOutput()
          Returns whether the minimal output option is set.
 boolean isSuppressWarnings()
          returns whether the suppress warnings option is on
 java.lang.Object load(java.io.File file)
          Loads one object from a file in Yaml format
 java.lang.Object load(java.io.InputStream in)
          Loads one object from an input stream
 java.lang.Object load(java.lang.String yamlText)
          Loads one object from a string of Yaml text
 YamlStream loadStream(java.io.File file)
          Loads the objects in a file in Yaml format into a YamlStream, which is used to iterate the objects in the file
 YamlStream loadStream(java.io.InputStream in)
          Loads the objects in input stream in Yaml format into a YamlStream, which is used to iterate the objects in the input stream
 YamlStream loadStream(java.lang.String yamlText)
          Loads the objects in a Yaml text into a YamlStream, which is used to iterate the objects in the Yaml text
<T> YamlStream<T>
loadStreamOfType(java.io.File file, java.lang.Class<T> clazz)
          Loads the objects of a specified type in a file in Yaml format into a YamlStream, which is used to iterate the objects in the file
<T> YamlStream<T>
loadStreamOfType(java.io.InputStream in, java.lang.Class<T> clazz)
          Loads the objects of a specified type in an input stream in Yaml format into a YamlStream, which is used to iterate the objects in the input stream
<T> YamlStream<T>
loadStreamOfType(java.lang.String yamlText, java.lang.Class<T> clazz)
          Loads the objects of a specified type in a in Yaml format into a YamlStream, which is used to iterate the objects in the file
<T> T
loadType(java.io.File file, java.lang.Class<T> clazz)
          Loads one object from a file in Yaml format
<T> T
loadType(java.io.InputStream in, java.lang.Class<T> clazz)
          Loads one object from an input stream of the specified type
<T> T
loadType(java.lang.String yamlText, java.lang.Class<T> clazz)
          Loads one object from a file in Yaml format
 void setIndentAmount(java.lang.String indentAmount)
          Sets indentation amount.
 void setMinimalOutput(boolean minimalOutput)
          Sets the minimal output option.
 void setSuppressWarnings(boolean suppressWarnings)
          sets the suppress warnings option
 void setTransfers(BiDirectionalMap<java.lang.String,java.lang.String> transferDictionary)
          sets the transfer-to-classname mapping for this configuration
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

YamlConfig

public YamlConfig()
Method Detail

getDefaultConfig

public static YamlConfig getDefaultConfig()
The default Jyaml configuration

Returns:
the default Jyaml configuration

getIndentAmount

public java.lang.String getIndentAmount()
Returns the indentation amount used for one indentation level.

Returns:
the amount of indentation used for one indentation level.

setIndentAmount

public void setIndentAmount(java.lang.String indentAmount)
Sets indentation amount.

Parameters:
indentAmount - must be a string consisting only of spaces.

isMinimalOutput

public boolean isMinimalOutput()
Returns whether the minimal output option is set.

Returns:
whether the minimal output option is set.

setMinimalOutput

public void setMinimalOutput(boolean minimalOutput)
Sets the minimal output option.

Parameters:
minimalOutput - true for on; false for off.

isSuppressWarnings

public boolean isSuppressWarnings()
returns whether the suppress warnings option is on

Returns:
whether the suppress warnings option is on

setSuppressWarnings

public void setSuppressWarnings(boolean suppressWarnings)
sets the suppress warnings option

Parameters:
suppressWarnings - true for on; false for off.

getTransfers

public BiDirectionalMap<java.lang.String,java.lang.String> getTransfers()
returns the transfer-to-classname mapping for this configuration

Returns:
a transfer-classname bi-directional map

setTransfers

public void setTransfers(BiDirectionalMap<java.lang.String,java.lang.String> transferDictionary)
sets the transfer-to-classname mapping for this configuration

Parameters:
transferDictionary - a transfer-classname bi-directional map

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object

fromFile

public static YamlConfig fromFile(java.lang.String filename)
                           throws java.io.FileNotFoundException,
                                  java.io.EOFException
Loads a YamlConfig from a Yaml configuration file

Parameters:
filename - the name of the file to load
Returns:
a YamlConfig object
Throws:
java.io.FileNotFoundException
java.io.EOFException

fromResource

public static YamlConfig fromResource(java.lang.String filename)
                               throws java.io.EOFException
Loads a YamlConfig from a resource on the classpath

Parameters:
filename - the name of the resource
Returns:
a YamlConfig object
Throws:
java.io.EOFException

load

public java.lang.Object load(java.io.InputStream in)
Description copied from interface: YamlOperations
Loads one object from an input stream

Specified by:
load in interface YamlOperations
Parameters:
in - the stream to read from
Returns:
the first object on the stream in Yaml format

load

public java.lang.Object load(java.io.File file)
                      throws java.io.FileNotFoundException
Description copied from interface: YamlOperations
Loads one object from a file in Yaml format

Specified by:
load in interface YamlOperations
Parameters:
file - the file to read from
Returns:
the first object in the file in Yaml format
Throws:
java.io.FileNotFoundException

load

public java.lang.Object load(java.lang.String yamlText)
Description copied from interface: YamlOperations
Loads one object from a string of Yaml text

Specified by:
load in interface YamlOperations
Parameters:
yamlText - the text to read from
Returns:
the first object in the Yaml text

loadType

public <T> T loadType(java.io.InputStream in,
                      java.lang.Class<T> clazz)
Description copied from interface: YamlOperations
Loads one object from an input stream of the specified type

Specified by:
loadType in interface YamlOperations
Type Parameters:
T - the specified type
Parameters:
in - the stream to read from
clazz - the class of the specified type
Returns:
the first object in the stream in Yaml format

loadType

public <T> T loadType(java.io.File file,
                      java.lang.Class<T> clazz)
           throws java.io.FileNotFoundException
Description copied from interface: YamlOperations
Loads one object from a file in Yaml format

Specified by:
loadType in interface YamlOperations
Type Parameters:
T - the specified type
Parameters:
file - the file to read from
clazz - the class of the specified type
Returns:
the first object in the file in Yaml format
Throws:
java.io.FileNotFoundException

loadType

public <T> T loadType(java.lang.String yamlText,
                      java.lang.Class<T> clazz)
Description copied from interface: YamlOperations
Loads one object from a file in Yaml format

Specified by:
loadType in interface YamlOperations
Type Parameters:
T - the specified type
Parameters:
yamlText - the Yaml text
clazz - the class of the specified type
Returns:
the first object in the Yaml text

loadStream

public YamlStream loadStream(java.io.InputStream in)
Description copied from interface: YamlOperations
Loads the objects in input stream in Yaml format into a YamlStream, which is used to iterate the objects in the input stream

Specified by:
loadStream in interface YamlOperations
Parameters:
in - the stream to read from
Returns:
a YamlStream for iterating the objects

loadStream

public YamlStream loadStream(java.io.File file)
                      throws java.io.FileNotFoundException
Description copied from interface: YamlOperations
Loads the objects in a file in Yaml format into a YamlStream, which is used to iterate the objects in the file

Specified by:
loadStream in interface YamlOperations
Parameters:
file - the file to read from
Returns:
a YamlStream for iterating the objects
Throws:
java.io.FileNotFoundException

loadStream

public YamlStream loadStream(java.lang.String yamlText)
Description copied from interface: YamlOperations
Loads the objects in a Yaml text into a YamlStream, which is used to iterate the objects in the Yaml text

Specified by:
loadStream in interface YamlOperations
Returns:
a YamlStream for iterating the objects

loadStreamOfType

public <T> YamlStream<T> loadStreamOfType(java.io.InputStream in,
                                          java.lang.Class<T> clazz)
Description copied from interface: YamlOperations
Loads the objects of a specified type in an input stream in Yaml format into a YamlStream, which is used to iterate the objects in the input stream

Specified by:
loadStreamOfType in interface YamlOperations
Type Parameters:
T - the specified type
Parameters:
in - the stream to read from
clazz - the class of the specified type
Returns:
a YamlStream for iterating the objects

loadStreamOfType

public <T> YamlStream<T> loadStreamOfType(java.io.File file,
                                          java.lang.Class<T> clazz)
                               throws java.io.FileNotFoundException
Description copied from interface: YamlOperations
Loads the objects of a specified type in a file in Yaml format into a YamlStream, which is used to iterate the objects in the file

Specified by:
loadStreamOfType in interface YamlOperations
Type Parameters:
T - the specified type
Parameters:
file - the file to read from
clazz - the class of the specified type
Returns:
a YamlStream for iterating the objects
Throws:
java.io.FileNotFoundException

loadStreamOfType

public <T> YamlStream<T> loadStreamOfType(java.lang.String yamlText,
                                          java.lang.Class<T> clazz)
                               throws java.io.FileNotFoundException
Description copied from interface: YamlOperations
Loads the objects of a specified type in a in Yaml format into a YamlStream, which is used to iterate the objects in the file

Specified by:
loadStreamOfType in interface YamlOperations
Type Parameters:
T - the specified type
Parameters:
yamlText - the text to read from
clazz - the class of the specified type
Returns:
a YamlStream for iterating the objects
Throws:
java.io.FileNotFoundException

dump

public void dump(java.lang.Object obj,
                 java.io.File file)
          throws java.io.FileNotFoundException
Description copied from interface: YamlOperations
Dumps an object to a file in Yaml format

Specified by:
dump in interface YamlOperations
Parameters:
obj - the object to dump
file - the file to dump to
Throws:
java.io.FileNotFoundException

dump

public void dump(java.lang.Object obj,
                 java.io.File file,
                 boolean minimalOutput)
          throws java.io.FileNotFoundException
Description copied from interface: YamlOperations
Dumps an object to a file in Yaml format

Specified by:
dump in interface YamlOperations
Parameters:
obj - the object to dump
file - the file to dump to
minimalOutput - whether minimal output is on
Throws:
java.io.FileNotFoundException

dumpStream

public void dumpStream(java.util.Iterator iterator,
                       java.io.File file,
                       boolean minimalOutput)
                throws java.io.FileNotFoundException
Description copied from interface: YamlOperations
Dumps a stream of objects specified with an iterator to a file in Yaml format, one document per object

Specified by:
dumpStream in interface YamlOperations
Parameters:
iterator - the iterator to read objects from
file - the file to write to
minimalOutput - whether minimal output is on
Throws:
java.io.FileNotFoundException

dumpStream

public void dumpStream(java.util.Iterator iterator,
                       java.io.File file)
                throws java.io.FileNotFoundException
Description copied from interface: YamlOperations
Dumps a stream of objects specified with an iterator to a file in Yaml format, one document per object

Specified by:
dumpStream in interface YamlOperations
Parameters:
iterator - the iterator to read objects from
file - the file to write to
Throws:
java.io.FileNotFoundException

dump

public java.lang.String dump(java.lang.Object obj)
Description copied from interface: YamlOperations
Dumps an object into Yaml format

Specified by:
dump in interface YamlOperations
Parameters:
obj - the object to dump
Returns:
a String in Yaml format representing the object

dump

public java.lang.String dump(java.lang.Object obj,
                             boolean minimalOutput)
Description copied from interface: YamlOperations
Dumps an object into Yaml format

Specified by:
dump in interface YamlOperations
Parameters:
obj - the object to dump
minimalOutput - whether minimal output is on
Returns:
a String in Yaml format representing the object

dumpStream

public java.lang.String dumpStream(java.util.Iterator iterator)
Description copied from interface: YamlOperations
Dumps a stream of objects specified with an iterator to a String in Yaml format, one document per object

Specified by:
dumpStream in interface YamlOperations
Parameters:
iterator - the iterator to read objects from
Returns:
a String in Yaml format representing the object

dumpStream

public java.lang.String dumpStream(java.util.Iterator iterator,
                                   boolean minimalOutput)
Description copied from interface: YamlOperations
Dumps a stream of objects specified with an iterator to a String in Yaml format, one document per object

Specified by:
dumpStream in interface YamlOperations
Parameters:
iterator - the iterator to read objects from
minimalOutput - whether minimal output is on
Returns:
a String in Yaml format representing the object


Copyright © 2007 JUG Padova Parancoe Team. All Rights Reserved.