org.opt4j.core.config
Class ModuleSaver

java.lang.Object
  extended by org.opt4j.core.config.ModuleSaver

public class ModuleSaver
extends java.lang.Object

Helper class for saving the PropertyModule configurations or adding these to XML Nodes.


Constructor Summary
ModuleSaver()
           
 
Method Summary
protected  org.w3c.dom.Document getEmptyDocument()
           
protected  org.w3c.dom.Node getNode(com.google.inject.Module module, org.w3c.dom.Document document)
           
protected  javax.xml.transform.Transformer getStandardTransformer()
           
 boolean save(java.io.File file, java.util.Collection<? extends com.google.inject.Module> modules)
          Save the module configurations to a File.
 boolean save(java.lang.String filename, java.util.Collection<? extends com.google.inject.Module> modules)
          Save the module configurations to a file (as filename).
 java.lang.String toXMLString(java.util.Collection<? extends com.google.inject.Module> modules)
          Returns the xml representation of the Modules.
 java.lang.String toXMLString(com.google.inject.Module module)
          Returns the xml representation of the Module.
 boolean write(java.io.OutputStream out, java.util.Collection<? extends com.google.inject.Module> modules)
          Save the modules configuration to an OutputStream.
 boolean write(java.io.OutputStream out, com.google.inject.Module module)
          Save the module configuration to an OutputStream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ModuleSaver

public ModuleSaver()
Method Detail

save

public boolean save(java.lang.String filename,
                    java.util.Collection<? extends com.google.inject.Module> modules)
Save the module configurations to a file (as filename).

Parameters:
filename - the name of the file
modules - the modules
Returns:
true if successful

save

public boolean save(java.io.File file,
                    java.util.Collection<? extends com.google.inject.Module> modules)
Save the module configurations to a File.

Parameters:
file - the file
modules - the modules
Returns:
true if successful

write

public boolean write(java.io.OutputStream out,
                     java.util.Collection<? extends com.google.inject.Module> modules)
Save the modules configuration to an OutputStream.

Parameters:
out - the output stream
modules - the modules
Returns:
true if successful

write

public boolean write(java.io.OutputStream out,
                     com.google.inject.Module module)
Save the module configuration to an OutputStream.

Parameters:
out - the output stream}
module - the module
Returns:
true if successful

toXMLString

public java.lang.String toXMLString(com.google.inject.Module module)
Returns the xml representation of the Module.

Parameters:
module - the module
Returns:
the xml representation

toXMLString

public java.lang.String toXMLString(java.util.Collection<? extends com.google.inject.Module> modules)
Returns the xml representation of the Modules.

Parameters:
modules - the modules
Returns:
the xml representation

getEmptyDocument

protected org.w3c.dom.Document getEmptyDocument()
                                         throws javax.xml.parsers.ParserConfigurationException
Throws:
javax.xml.parsers.ParserConfigurationException

getStandardTransformer

protected javax.xml.transform.Transformer getStandardTransformer()
                                                          throws javax.xml.transform.TransformerConfigurationException
Throws:
javax.xml.transform.TransformerConfigurationException

getNode

protected org.w3c.dom.Node getNode(com.google.inject.Module module,
                                   org.w3c.dom.Document document)