private static class JsonRenderer.FieldConsumer extends Object implements Hit.RawUtf8Consumer
Modifier and Type | Field and Description |
---|---|
private boolean |
debugRendering |
private com.fasterxml.jackson.core.JsonGenerator |
generator |
private com.yahoo.lang.MutableBoolean |
hasFieldsField |
Constructor and Description |
---|
FieldConsumer(com.fasterxml.jackson.core.JsonGenerator generator,
boolean debugRendering) |
Modifier and Type | Method and Description |
---|---|
void |
accept(String name,
byte[] utf8Data,
int offset,
int length)
Called for fields which are available as UTF-8 instead of accept(String, Object).
|
void |
accept(String name,
Object value) |
(package private) void |
endHitFields()
Call after all fields in a hit to close the "fields" field of the JSON object
|
(package private) void |
ensureFieldsField()
Call before rendering a field to the generator
|
private void |
renderFieldContents(Object field) |
private void |
renderInspector(com.yahoo.data.access.Inspector data) |
private void |
renderNumberField(Number field) |
private void |
renderTensor(Optional<com.yahoo.tensor.Tensor> tensor) |
private boolean |
shouldRender(String name,
Object value) |
private boolean |
shouldRenderUtf8Value(String name,
int length) |
(package private) void |
startHitFields()
Call before using this for a hit to track whether we
have created the "fields" field of the JSON object
|
private static com.yahoo.data.access.Inspector |
wrapAsMap(com.yahoo.data.access.Inspector data) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
andThen
private final com.fasterxml.jackson.core.JsonGenerator generator
private final boolean debugRendering
private com.yahoo.lang.MutableBoolean hasFieldsField
public FieldConsumer(com.fasterxml.jackson.core.JsonGenerator generator, boolean debugRendering)
void startHitFields()
void ensureFieldsField() throws IOException
IOException
void endHitFields() throws IOException
IOException
public void accept(String name, Object value)
accept
in interface BiConsumer<String,Object>
public void accept(String name, byte[] utf8Data, int offset, int length)
Hit.RawUtf8Consumer
accept
in interface Hit.RawUtf8Consumer
name
- the name of the fieldutf8Data
- raw utf-8 data. The reciver must not modify this dataoffset
- the start index of the data to accept into the utf8Data arraylength
- the length of the data to accept into the utf8Data arrayprivate boolean shouldRenderUtf8Value(String name, int length)
private static com.yahoo.data.access.Inspector wrapAsMap(com.yahoo.data.access.Inspector data)
private void renderInspector(com.yahoo.data.access.Inspector data) throws IOException
IOException
private void renderFieldContents(Object field) throws IOException
IOException
private void renderNumberField(Number field) throws IOException
IOException
private void renderTensor(Optional<com.yahoo.tensor.Tensor> tensor) throws IOException
IOException
Copyright © 2018. All rights reserved.