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 TypeMethodDescriptionvoidformat(StateInf stateFile, PrintStream stream) Create ouput format.protected voidprint(String name, String value, boolean isFirst, boolean isNumeric, int lvl, PrintStream stream) Formatted entry valueprotected intprintBegin(StateInf state, PrintStream stream) Beginning of formattingprotected voidprintClose(String name, int lvl, PrintStream stream) Closing element entry.protected voidprintEnd(PrintStream stream) End of formattingprotected voidprintStart(String name, boolean isFirst, int lvl, PrintStream stream) Beginning element entry.protected Fileprotected voidwriteStream(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, writelnMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:FormatterInfCreate ouput format. Using the StateInf object, create a formatted output to this print stream- Specified by:
formatin interfaceFormatterInf- Overrides:
formatin classFormatterAbs- Parameters:
stateFile- object to be formattedstream- output for formatted data- Throws:
TException
-
writeStream
- Throws:
TException
-
transform
- Throws:
TException
-
printBegin
Description copied from class:FormatterAbsBeginning of formatting- Specified by:
printBeginin classFormatterAbs- Parameters:
stream- print output stream- Returns:
- starting level (used for indentation - typically 1)
- Throws:
TException
-
printEnd
Description copied from class:FormatterAbsEnd of formatting- Specified by:
printEndin 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:FormatterAbsBeginning element entry. An example would be the element name in XML- Specified by:
printStartin 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:FormatterAbsClosing element entry. Example is closeing element in XML- Specified by:
printClosein 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:FormatterAbsFormatted entry value- Specified by:
printin 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
-