Package view.output
Class JSONFileWriter
java.lang.Object
view.output.JSONFileWriter
- All Implemented Interfaces:
IDescriptor,IOutput
public class JSONFileWriter extends java.lang.Object implements IOutput
JSONFileWriter class implements
IOutput. Output module to print
composite structure as JSON to a file.-
Field Summary
Fields Modifier and Type Field Description private static java.lang.StringDESCRIPTIONprivate java.io.Filefileprivate FileWriterWrapperfwprivate com.google.gson.Gsongsonprivate static java.lang.StringNAME -
Constructor Summary
Constructors Constructor Description JSONFileWriter()The default constructor is mentioned explicitly because a modified constructor is required for the tests.JSONFileWriter(java.io.File f)Modified constructor for testing which takes a file. -
Method Summary
Modifier and Type Method Description java.lang.StringgetDescription()Returns description of implemented module.java.lang.StringgetName()Returns decent name of class.voidoutput(CompositeContainer container)Outputs the contents of the composite structurevoidreset()Resets the Output module object to its initial state.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
NAME
private static final java.lang.String NAME- See Also:
- Constant Field Values
-
DESCRIPTION
private static final java.lang.String DESCRIPTION- See Also:
- Constant Field Values
-
file
private java.io.File file -
gson
private com.google.gson.Gson gson -
fw
-
-
Constructor Details
-
JSONFileWriter
public JSONFileWriter()The default constructor is mentioned explicitly because a modified constructor is required for the tests. -
JSONFileWriter
public JSONFileWriter(java.io.File f)Modified constructor for testing which takes a file.- Parameters:
f-File
-
-
Method Details
-
output
Description copied from interface:IOutputOutputs the contents of the composite structure -
getName
public java.lang.String getName()Description copied from interface:IDescriptorReturns decent name of class.- Specified by:
getNamein interfaceIDescriptor- Returns:
- Decent name of class
-
getDescription
public java.lang.String getDescription()Description copied from interface:IDescriptorReturns description of implemented module.- Specified by:
getDescriptionin interfaceIDescriptor- Returns:
- Description
-
reset
public void reset()Description copied from interface:IOutputResets the Output module object to its initial state.
-