public abstract class AbstractJsonConvertibleRecord extends java.lang.Object implements JsonConvertibleRecord
createIOMaps method to define the input and output
Predicate maps that determine how objects, fields, arrays should be stored
using the Jackson streaming API.
For examples, see MarsRecord, AbstractMolecule,
AbstractMarsMetadata.
| Constructor and Description |
|---|
AbstractJsonConvertibleRecord()
Constructor for creating a JsonConvertibleRecord.
|
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
createIOMaps()
Must be implemented in subclasses to define how fields, objects, arrays
should be saved based on the Jackson streaming API.
|
java.lang.String |
dumpJSON()
Get the record in Json string format.
|
void |
fromJSON(com.fasterxml.jackson.core.JsonParser jParser)
Read a record from JSON.
|
java.util.function.Predicate<com.fasterxml.jackson.core.JsonGenerator> |
getJsonGenerator(java.lang.String field)
Get the JsonGenerator for a field.
|
java.util.function.Predicate<com.fasterxml.jackson.core.JsonParser> |
getJsonParser(java.lang.String field)
Get the JsonParser for a field.
|
void |
setJsonField(java.lang.String field,
MarsUtil.ThrowingConsumer<com.fasterxml.jackson.core.JsonGenerator,java.io.IOException> output,
MarsUtil.ThrowingConsumer<com.fasterxml.jackson.core.JsonParser,java.io.IOException> input) |
void |
setShowWarnings(boolean showWarnings) |
void |
toJSON(com.fasterxml.jackson.core.JsonGenerator jGenerator)
Stream a record to JSON.
|
public AbstractJsonConvertibleRecord()
public void toJSON(com.fasterxml.jackson.core.JsonGenerator jGenerator)
throws java.io.IOException
toJSON in interface JsonConvertibleRecordjGenerator - A JsonGenerator for streaming a record to a file.java.io.IOException - if there is a problem reading from the file.public void fromJSON(com.fasterxml.jackson.core.JsonParser jParser)
throws java.io.IOException
fromJSON in interface JsonConvertibleRecordjParser - A JsonParser for loading the record from a file.java.io.IOException - if there is a problem reading from the file.public void setShowWarnings(boolean showWarnings)
setShowWarnings in interface JsonConvertibleRecordpublic void setJsonField(java.lang.String field,
MarsUtil.ThrowingConsumer<com.fasterxml.jackson.core.JsonGenerator,java.io.IOException> output,
MarsUtil.ThrowingConsumer<com.fasterxml.jackson.core.JsonParser,java.io.IOException> input)
setJsonField in interface JsonConvertibleRecordpublic java.util.function.Predicate<com.fasterxml.jackson.core.JsonGenerator> getJsonGenerator(java.lang.String field)
getJsonGenerator in interface JsonConvertibleRecordfield - Json field.public java.util.function.Predicate<com.fasterxml.jackson.core.JsonParser> getJsonParser(java.lang.String field)
getJsonParser in interface JsonConvertibleRecordfield - Json field.public java.lang.String dumpJSON()
dumpJSON in interface JsonConvertibleRecordprotected abstract void createIOMaps()