Package com.yahoo.search.rendering
Class JsonRenderer.FieldConsumer
- java.lang.Object
-
- com.yahoo.search.rendering.JsonRenderer.FieldConsumer
-
- All Implemented Interfaces:
com.yahoo.container.logging.TraceRenderer.FieldConsumer
,Hit.RawUtf8Consumer
,BiConsumer<String,Object>
- Enclosing class:
- JsonRenderer
public static class JsonRenderer.FieldConsumer extends Object implements Hit.RawUtf8Consumer, com.yahoo.container.logging.TraceRenderer.FieldConsumer
Received callbacks when fields of hits are encountered. This instance is reused for all hits of a Result since we are in a single-threaded context and want to limit object creation.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
FieldConsumer(boolean debugRendering, boolean tensorShortForm, boolean jsonMaps)
Invoke this from your constructor when sub-classingJsonRenderer.FieldConsumer
FieldConsumer(com.fasterxml.jackson.core.JsonGenerator generator, boolean debugRendering)
Deprecated, for removal: This API element is subject to removal in a future version.Will be removed in Vespa 8.FieldConsumer(com.fasterxml.jackson.core.JsonGenerator generator, boolean debugRendering, boolean tensorShortForm)
Deprecated, for removal: This API element is subject to removal in a future version.Will be removed in Vespa 8.FieldConsumer(com.fasterxml.jackson.core.JsonGenerator generator, boolean debugRendering, boolean tensorShortForm, boolean jsonMaps)
Deprecated, for removal: This API element is subject to removal in a future version.Will be removed in Vespa 8.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
accept(Object field)
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)
protected void
renderFieldContents(Object field)
protected boolean
shouldRender(String name, Object value)
protected boolean
shouldRenderUtf8Value(String name, int length)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.function.BiConsumer
andThen
-
-
-
-
Constructor Detail
-
FieldConsumer
@Deprecated(forRemoval=true, since="7") public FieldConsumer(com.fasterxml.jackson.core.JsonGenerator generator, boolean debugRendering)
Deprecated, for removal: This API element is subject to removal in a future version.Will be removed in Vespa 8. UseFieldConsumer(boolean, boolean, boolean)
instead.
-
FieldConsumer
@Deprecated(forRemoval=true, since="7") public FieldConsumer(com.fasterxml.jackson.core.JsonGenerator generator, boolean debugRendering, boolean tensorShortForm)
Deprecated, for removal: This API element is subject to removal in a future version.Will be removed in Vespa 8. UseFieldConsumer(boolean, boolean, boolean)
instead.
-
FieldConsumer
protected FieldConsumer(boolean debugRendering, boolean tensorShortForm, boolean jsonMaps)
Invoke this from your constructor when sub-classingJsonRenderer.FieldConsumer
-
FieldConsumer
@Deprecated(forRemoval=true, since="7") public FieldConsumer(com.fasterxml.jackson.core.JsonGenerator generator, boolean debugRendering, boolean tensorShortForm, boolean jsonMaps)
Deprecated, for removal: This API element is subject to removal in a future version.Will be removed in Vespa 8. UseFieldConsumer(boolean, boolean, boolean)
instead.
-
-
Method Detail
-
accept
public void accept(String name, Object value)
- Specified by:
accept
in interfaceBiConsumer<String,Object>
-
accept
public void accept(String name, byte[] utf8Data, int offset, int length)
Description copied from interface:Hit.RawUtf8Consumer
Called for fields which are available as UTF-8 instead of accept(String, Object).- Specified by:
accept
in interfaceHit.RawUtf8Consumer
- Parameters:
name
- the name of the fieldutf8Data
- raw utf-8 data. The receiver must not modify this dataoffset
- the start index in the utf8Data array of the data to acceptlength
- the length starting from offset in the utf8Data array of the data to accept
-
shouldRenderUtf8Value
protected boolean shouldRenderUtf8Value(String name, int length)
-
renderFieldContents
protected void renderFieldContents(Object field) throws IOException
- Throws:
IOException
-
accept
public void accept(Object field) throws IOException
- Specified by:
accept
in interfacecom.yahoo.container.logging.TraceRenderer.FieldConsumer
- Throws:
IOException
-
-