Class FlatFileFormatter
- java.lang.Object
-
- org.intermine.webservice.server.output.Formatter
-
- org.intermine.webservice.server.output.FlatFileFormatter
-
- Direct Known Subclasses:
CSVFormatter,TabFormatter
public abstract class FlatFileFormatter extends Formatter
A class to define behaviour common to flat files (csv, tsv)- Author:
- Alexis Kalderimis
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCOLUMN_HEADERSThe key for the header columnsstatic java.lang.StringERROR_INTROThe string that begins an error line.protected RowFormatterlabourer
-
Constructor Summary
Constructors Constructor Description FlatFileFormatter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringformatFooter(java.lang.String errorMessage, int errorCode)Returns formatted footer.java.lang.StringformatHeader(java.util.Map<java.lang.String,java.lang.Object> attributes)Returns formatted header.java.lang.StringformatResult(java.util.List<java.lang.String> resultRow)Returns formatted result item.protected RowFormattergetRowFormatter()Get the row formatterprotected voidsetRowFormatter(RowFormatter fmtr)Set the row formatter
-
-
-
Field Detail
-
ERROR_INTRO
public static final java.lang.String ERROR_INTRO
The string that begins an error line.- See Also:
- Constant Field Values
-
COLUMN_HEADERS
public static final java.lang.String COLUMN_HEADERS
The key for the header columns- See Also:
- Constant Field Values
-
labourer
protected RowFormatter labourer
-
-
Method Detail
-
getRowFormatter
protected RowFormatter getRowFormatter()
Get the row formatter- Returns:
- the object that formats the rows
-
setRowFormatter
protected void setRowFormatter(RowFormatter fmtr)
Set the row formatter- Parameters:
fmtr- A RowFormatter implementation
-
formatHeader
public java.lang.String formatHeader(java.util.Map<java.lang.String,java.lang.Object> attributes)
Returns formatted header.}- Specified by:
formatHeaderin classFormatter- Parameters:
attributes- attributes contained in header- Returns:
- formatted header
-
formatResult
public java.lang.String formatResult(java.util.List<java.lang.String> resultRow)
Description copied from class:FormatterReturns formatted result item.- Specified by:
formatResultin classFormatter- Parameters:
resultRow- result row- Returns:
- formatted result row
-
formatFooter
public java.lang.String formatFooter(java.lang.String errorMessage, int errorCode)Description copied from class:FormatterReturns formatted footer.- Specified by:
formatFooterin classFormatter- Parameters:
errorMessage- The error message, if sth went wrong.errorCode- The error code, if sth went wrong.- Returns:
- formatted footer
-
-