public class JSONBulletRecordConverter extends MapBulletRecordConverter
BulletRecord
instances. The JSON must be an
object containing the fields of the record.
Double
. If a schema is provided, the appropriate
specified types will be used.config, schema, shouldTypeCheck
Constructor and Description |
---|
JSONBulletRecordConverter()
Constructs a JSONBulletRecordConverter without a schema.
|
JSONBulletRecordConverter(com.yahoo.bullet.common.BulletConfig bulletConfig)
Constructs a JSONBulletRecordConverter from a given configuration.
|
JSONBulletRecordConverter(String schema)
Constructs a JSONBulletRecordConverter from a given schema.
|
Modifier and Type | Method and Description |
---|---|
com.yahoo.bullet.record.BulletRecord |
convert(Object object,
com.yahoo.bullet.record.BulletRecord record)
Converts an object to a BulletRecord using the given record.
|
protected com.yahoo.bullet.typesystem.TypedObject |
getTypedObject(String name,
com.yahoo.bullet.typesystem.Type type,
Serializable value)
Converts the field value with the given name and expected type into a
TypedObject . |
get
build, convert, flattenMap, from, getField, setField
public JSONBulletRecordConverter() throws BulletDSLException
BulletDSLException
- if there is an error creating the converter.public JSONBulletRecordConverter(String schema) throws BulletDSLException
schema
- A schema file that specifies the fields to extract and their types.BulletDSLException
- if there is an error creating the converter.public JSONBulletRecordConverter(com.yahoo.bullet.common.BulletConfig bulletConfig) throws BulletDSLException
bulletConfig
- The configuration that specifies the settings for a JSONBulletRecordConverter.BulletDSLException
- if there is an error creating the converter.public com.yahoo.bullet.record.BulletRecord convert(Object object, com.yahoo.bullet.record.BulletRecord record) throws BulletDSLException
BulletRecordConverter
convert
in class MapBulletRecordConverter
object
- The object to be converted.record
- The record to insert fields into.BulletDSLException
- if there is an error converting the object to a BulletRecord.protected com.yahoo.bullet.typesystem.TypedObject getTypedObject(String name, com.yahoo.bullet.typesystem.Type type, Serializable value)
BulletRecordConverter
TypedObject
. If type checking is
enabled, it will check to make sure that the expected type matches the final type in the TypedObject
.
This method is only used for non-record fields.getTypedObject
in class BulletRecordConverter
name
- The name of the field.type
- The expected type of the field.value
- The Serializable
value of the field.TypedObject
wrapping the value.Copyright © 2021. All rights reserved.