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.String
DESCRIPTION
private java.io.File
file
private FileWriterWrapper
fw
private com.google.gson.Gson
gson
private static java.lang.String
NAME
-
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.String
getDescription()
Returns description of implemented module.java.lang.String
getName()
Returns decent name of class.void
output(CompositeContainer container)
Outputs the contents of the composite structurevoid
reset()
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:IOutput
Outputs the contents of the composite structure -
getName
public java.lang.String getName()Description copied from interface:IDescriptor
Returns decent name of class.- Specified by:
getName
in interfaceIDescriptor
- Returns:
- Decent name of class
-
getDescription
public java.lang.String getDescription()Description copied from interface:IDescriptor
Returns description of implemented module.- Specified by:
getDescription
in interfaceIDescriptor
- Returns:
- Description
-
reset
public void reset()Description copied from interface:IOutput
Resets the Output module object to its initial state.
-