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 structure
    void 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

  • 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

      public void output​(CompositeContainer container)
      Description copied from interface: IOutput
      Outputs the contents of the composite structure
      Specified by:
      output in interface IOutput
      Parameters:
      container - Root composite container
    • getName

      public java.lang.String getName()
      Description copied from interface: IDescriptor
      Returns decent name of class.
      Specified by:
      getName in interface IDescriptor
      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 interface IDescriptor
      Returns:
      Description
    • reset

      public void reset()
      Description copied from interface: IOutput
      Resets the Output module object to its initial state.
      Specified by:
      reset in interface IOutput