Class 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 Detail

      • FieldConsumer

        public FieldConsumer​(com.fasterxml.jackson.core.JsonGenerator generator,
                             boolean debugRendering)
      • FieldConsumer

        public FieldConsumer​(com.fasterxml.jackson.core.JsonGenerator generator,
                             boolean debugRendering,
                             boolean tensorShortForm)
      • FieldConsumer

        public FieldConsumer​(com.fasterxml.jackson.core.JsonGenerator generator,
                             boolean debugRendering,
                             boolean tensorShortForm,
                             boolean jsonMaps)
    • Method Detail

      • 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 interface Hit.RawUtf8Consumer
        Parameters:
        name - the name of the field
        utf8Data - raw utf-8 data. The receiver must not modify this data
        offset - the start index in the utf8Data array of the data to accept
        length - the length starting from offset in the utf8Data array of the data to accept
      • shouldRender

        protected boolean shouldRender​(String name,
                                       Object value)
      • shouldRenderUtf8Value

        protected boolean shouldRenderUtf8Value​(String name,
                                                int length)
      • accept

        public void accept​(Object field)
                    throws IOException
        Specified by:
        accept in interface com.yahoo.container.logging.TraceRenderer.FieldConsumer
        Throws:
        IOException