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.String
COLUMN_HEADERS
The key for the header columnsstatic java.lang.String
ERROR_INTRO
The string that begins an error line.protected RowFormatter
labourer
-
Constructor Summary
Constructors Constructor Description FlatFileFormatter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
formatFooter(java.lang.String errorMessage, int errorCode)
Returns formatted footer.java.lang.String
formatHeader(java.util.Map<java.lang.String,java.lang.Object> attributes)
Returns formatted header.java.lang.String
formatResult(java.util.List<java.lang.String> resultRow)
Returns formatted result item.protected RowFormatter
getRowFormatter()
Get the row formatterprotected void
setRowFormatter(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:
formatHeader
in 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:Formatter
Returns formatted result item.- Specified by:
formatResult
in 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:Formatter
Returns formatted footer.- Specified by:
formatFooter
in classFormatter
- Parameters:
errorMessage
- The error message, if sth went wrong.errorCode
- The error code, if sth went wrong.- Returns:
- formatted footer
-
-