Package com.streambase.sb
Class Tuple.DefaultTupleFormatter
java.lang.Object
com.streambase.sb.Tuple.DefaultTupleFormatter
- All Implemented Interfaces:
 Tuple.TupleFormatter
- Enclosing class:
 Tuple
A default formatter that converts each type to String using Java
 default String conversions. The intent of this formatter is human consumption,
 not CSV parsing. Special formatting is performed for:
 
- Timestamp, via 
Timestamp.toString() - Blobs, displayed in their entirety as Strings (using US-ASCII characters, or
 the charset declared via the 
streambase.tuple-charsetsystem property) - Tuples, displayed as a comma-separated string of each of its field's stringification using this formatter
 - Lists, displayed as a [] enclosed string of each element stringified using this formatter, delimited by comma
 - Functions, displayed using a JSON syntax
 - Null values, returned as 
Tuple.NULL_STRING 
 A shared instance is available at Tuple.getTupleFormatter().
- Since:
 - 7.1 this formatter is now used recursively for list elements and tuple sub-fields
 
- 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionformatBlob(ByteArrayView blob) Return a string representation of the given StreamBase blob valueReturn a string representation of the given StreamBase boolean valueReturn a string representation of the given StreamBase double valueReturn a string representation of the given StreamBase functionReturn a string representation of the given StreamBase integer valueformatList(CompleteDataType elementType, List<?> l) Return a string representation of the given StreamBase listformatLong(Long l) Return a string representation of the given StreamBase long valueReturn a string representation of the given StreamBase string valueReturn a string representation of the given StreamBase timestamp valueformatTuple(Tuple t) Return a string representation of the given StreamBase Tuple valueprotected StringThis value will be returned by this formatter when any null field value is asked to be formatted. 
- 
Constructor Details
- 
DefaultTupleFormatter
public DefaultTupleFormatter()See the class documentation forTuple.DefaultTupleFormatterfor details 
 - 
 - 
Method Details
- 
getNullString
This value will be returned by this formatter when any null field value is asked to be formatted. Clients may override.- Returns:
 - by default, this implementation returns 
Tuple.NULL_STRING 
 - 
formatBlob
Description copied from interface:Tuple.TupleFormatterReturn a string representation of the given StreamBase blob value- Specified by:
 formatBlobin interfaceTuple.TupleFormatter- Parameters:
 blob- may be null- Returns:
 - a non-null string representation of the value given
 
 - 
formatTimestamp
Description copied from interface:Tuple.TupleFormatterReturn a string representation of the given StreamBase timestamp value- Specified by:
 formatTimestampin interfaceTuple.TupleFormatter- Parameters:
 t- may be null- Returns:
 - a non-null string representation of the value given
 
 - 
formatString
Description copied from interface:Tuple.TupleFormatterReturn a string representation of the given StreamBase string value- Specified by:
 formatStringin interfaceTuple.TupleFormatter- Parameters:
 s- may be null- Returns:
 - a non-null string representation of the value given
 
 - 
formatInt
Description copied from interface:Tuple.TupleFormatterReturn a string representation of the given StreamBase integer value- Specified by:
 formatIntin interfaceTuple.TupleFormatter- Parameters:
 i- may be null- Returns:
 - a non-null string representation of the value given
 
 - 
formatDouble
Description copied from interface:Tuple.TupleFormatterReturn a string representation of the given StreamBase double value- Specified by:
 formatDoublein interfaceTuple.TupleFormatter- Parameters:
 d- may be null- Returns:
 - a non-null string representation of the value given
 
 - 
formatLong
Description copied from interface:Tuple.TupleFormatterReturn a string representation of the given StreamBase long value- Specified by:
 formatLongin interfaceTuple.TupleFormatter- Parameters:
 l- may be null- Returns:
 - a non-null string representation of the value given
 
 - 
formatBool
Description copied from interface:Tuple.TupleFormatterReturn a string representation of the given StreamBase boolean value- Specified by:
 formatBoolin interfaceTuple.TupleFormatter- Parameters:
 b- may be null- Returns:
 - a non-null string representation of the value given
 
 - 
formatTuple
Description copied from interface:Tuple.TupleFormatterReturn a string representation of the given StreamBase Tuple value- Specified by:
 formatTuplein interfaceTuple.TupleFormatter- Parameters:
 t- may be null- Returns:
 - a non-null string representation of the value given
 
 - 
formatList
Description copied from interface:Tuple.TupleFormatterReturn a string representation of the given StreamBase list- Specified by:
 formatListin interfaceTuple.TupleFormatter- Parameters:
 elementType- the data type of all list elementsl- may be null- Returns:
 - a non-null string representation of the value given
 
 - 
formatFunction
Description copied from interface:Tuple.TupleFormatterReturn a string representation of the given StreamBase function- Specified by:
 formatFunctionin interfaceTuple.TupleFormatter- Parameters:
 f- may be null- Returns:
 - a non-null string representation of the value given
 
 
 -