Package com.streambase.sb
Class TupleJSONUtil.SetTupleFromJSON
java.lang.Object
com.streambase.sb.TupleJSONUtil.SetTupleFromJSON
- Enclosing class:
 TupleJSONUtil
The Builder class which handles the setting of tuples from JSON Data.
 This has several parameters which can be specified using the respective builder methods.
 These builder methods are:
      
 
 
 
 
Two static instances are provided:
withParseStyle(com.streambase.sb.ParseStyle)        whether to throw an exception when fields are missing from tuple's schema (ParseStyle.STRICT) or not (ParseStyle.LOOSE)
      withTimestampStyle(com.streambase.sb.Timestamp.Type)    timestampStyle Whether the numeric values in a timestamp field will be converted to an Timestamp.Type.INTERVAL or a Timestamp.Type.TIMESTAMP
      withTimestampFormat(java.lang.String)   the string representation of the timestamp format to use when converting
      withEmptyStringValue(java.lang.String)  the string specifying what an empty/null json field should evaluate to
      Two static instances are provided:
STRICT and LOOSE,
      which set all defaults except for the parseStyle, which instead corresponds to the instance name.
      STRICT can be used as a plain default instance with no modifications.- 
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final TupleJSONUtil.SetTupleFromJSONEstablishes a new SetTupleFromJSON with default settings, except parseStyle is Loose.static final TupleJSONUtil.SetTupleFromJSONEstablishes a new SetTupleFromJSON with default settings, except parseStyle is Strict. - 
Method Summary
Modifier and TypeMethodDescriptionbooleaninthashCode()Handles the processing of a JSON value into a tuple, replaces the deprecated setTupleFromJSON and setTuple methods in the API.toString()withEmptyStringValue(String value) Sets the emptyString value of a new SetTupleFromJSON and returns it.withParseStyle(ParseStyle style) Sets the parsestyle of a new SetTupleFromJSON and returns it.withTimestampFormat(String format) Sets the timestamp format of a new SetTupleFromJSON and returns it.withTimestampStyle(Timestamp.Type style) Sets the timestampStyle of a new SetTupleFromJSON and returns it. 
- 
Field Details
- 
STRICT
Establishes a new SetTupleFromJSON with default settings, except parseStyle is Strict.
- ParseStyle ->ParseStyle.STRICT,
- TimeStyle ->Timestamp.Type.TIMESTAMP,
- TimestampFormat -> "",
- EmptyStringJsonValue -> "" - 
LOOSE
Establishes a new SetTupleFromJSON with default settings, except parseStyle is Loose.
- ParseStyle ->ParseStyle.LOOSE,
- TimeStyle ->Timestamp.Type.TIMESTAMP,
- TimestampFormat -> "",
- EmptyStringJsonValue -> "" 
 - 
 - 
Method Details
- 
withParseStyle
Sets the parsestyle of a new SetTupleFromJSON and returns it.- Parameters:
 style- the style to use.- Returns:
 - a new SetTupleFromJSON with parseStyle set.
 
 - 
withTimestampStyle
Sets the timestampStyle of a new SetTupleFromJSON and returns it.- Parameters:
 style- the style to use.- Returns:
 - a new SetTupleFromJSON with timestampStyle set.
 
 - 
withTimestampFormat
Sets the timestamp format of a new SetTupleFromJSON and returns it.- Parameters:
 format- the format to use- Returns:
 - a new SetTupleFromJSON with timestampFormat set.
 
 - 
withEmptyStringValue
Sets the emptyString value of a new SetTupleFromJSON and returns it.- Parameters:
 value- the string to use- Returns:
 - a new SetTupleFromJSON with emptyStringJsonValue set.
 
 - 
process
public TupleJSONUtil.SetTupleFromJSON process(String jsonVal, Tuple tuple) throws StreamBaseException Handles the processing of a JSON value into a tuple, replaces the deprecated setTupleFromJSON and setTuple methods in the API.- Parameters:
 jsonVal- the JSON string; must have at least the fields of the tuple's schematuple- the tuple to set- Returns:
 - this
 - Throws:
 StreamBaseException- conversion to tuple error.
 - 
toString
 - 
equals
 - 
hashCode
 
 -