Package org.cdlib.mrt.formatter
Class JSONFormatter
java.lang.Object
org.cdlib.mrt.formatter.FormatterAbs
org.cdlib.mrt.formatter.JSONFormatter
- All Implemented Interfaces:
FormatterInf
JSON output display formatter
- Author:
- dloy
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.cdlib.mrt.formatter.FormatterInf
FormatterInf.Format
-
Field Summary
FieldsFields inherited from class org.cdlib.mrt.formatter.FormatterAbs
DEBUG, formatterType, logger, MESSAGE, NAME, NL
-
Constructor Summary
ConstructorsConstructorDescriptionJSONFormatter
(String mapperName, LoggerInf logger) JSONFormatter
(LoggerInf logger) -
Method Summary
Modifier and TypeMethodDescriptionvoid
format
(StateInf stateFile, PrintStream stream) Create ouput format.protected void
print
(String name, String value, boolean isFirst, boolean isNumeric, int lvl, PrintStream stream) Formatted entry valueprotected int
printBegin
(StateInf state, PrintStream stream) Beginning of formattingprotected void
printClose
(String name, int lvl, PrintStream stream) Closing element entry.protected void
printEnd
(PrintStream stream) End of formattingprotected void
printStart
(String name, boolean isFirst, int lvl, PrintStream stream) Beginning element entry.protected File
protected void
writeStream
(File formatFile, PrintStream stream) Methods inherited from class org.cdlib.mrt.formatter.FormatterAbs
addLvl, closeOutput, display, formatClass, formatNamedNode, formatNode, formatObject, getANVLFormatter, getFormatter, getFormatterType, getJSONFormatter, getJSONFormatter, getMethodName, getObjectName, getXHTMLFormatter, getXHTMLFormatter, getXMLFormatter, getXMLFormatter, interfaceMatches, isDisplayableClass, isDisplayMethod, isEnum, isLinkedHashList, isList, isMap, isNumeric, isNumeric, isNumeric, isStateClass, isStateStringClass, log, logDebug, logException, lowerCaseFirst, processLinkedHashList, processLinkedHashList, processList, processMap, processMap, returnsList, returnsMap, runMethod, runStringMethod, setFormatterType, write, writeln
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.cdlib.mrt.formatter.FormatterInf
getFormatterType
-
Field Details
-
xmlFormatter
-
mapperName
-
mapper
-
-
Constructor Details
-
JSONFormatter
- Throws:
TException
-
JSONFormatter
- Throws:
TException
-
-
Method Details
-
format
Description copied from interface:FormatterInf
Create ouput format. Using the StateInf object, create a formatted output to this print stream- Specified by:
format
in interfaceFormatterInf
- Overrides:
format
in classFormatterAbs
- Parameters:
stateFile
- object to be formattedstream
- output for formatted data- Throws:
TException
-
writeStream
- Throws:
TException
-
transform
- Throws:
TException
-
printBegin
Description copied from class:FormatterAbs
Beginning of formatting- Specified by:
printBegin
in classFormatterAbs
stream
- print output stream- Returns:
- starting level (used for indentation - typically 1)
- Throws:
TException
-
printEnd
Description copied from class:FormatterAbs
End of formatting- Specified by:
printEnd
in classFormatterAbs
- Parameters:
stream
- output stream- Throws:
TException
-
printStart
protected void printStart(String name, boolean isFirst, int lvl, PrintStream stream) throws TException Description copied from class:FormatterAbs
Beginning element entry. An example would be the element name in XML- Specified by:
printStart
in classFormatterAbs
- Parameters:
name
- element nameisFirst
- true=is first element of a list, false=subsequent element of listlvl
- indentation levelstream
- print output stream- Throws:
TException
-
printClose
Description copied from class:FormatterAbs
Closing element entry. Example is closeing element in XML- Specified by:
printClose
in classFormatterAbs
- Parameters:
name
- element namelvl
- indentation levelstream
- print output stream- Throws:
TException
-
print
protected void print(String name, String value, boolean isFirst, boolean isNumeric, int lvl, PrintStream stream) throws TException Description copied from class:FormatterAbs
Formatted entry value- Specified by:
print
in classFormatterAbs
- Parameters:
name
- name of entryvalue
- entry valueisFirst
- true=is first element of a list, false=subsequent element of listisNumeric
- is the element numeric or boolean. Some formats require quotes around value unless it is numericlvl
- indentation levelstream
- print output stream- Throws:
TException
-