Class JsonRenderer.FieldConsumer

  • All Implemented Interfaces:, Hit.RawUtf8Consumer, java.util.function.BiConsumer<java.lang.String,​java.lang.Object>
    Enclosing class:

    public static class JsonRenderer.FieldConsumer
    extends java.lang.Object
    implements Hit.RawUtf8Consumer,
    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

      Constructor Description
      FieldConsumer​(com.fasterxml.jackson.core.JsonGenerator generator, boolean debugRendering)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void accept​(java.lang.Object field)  
      void accept​(java.lang.String name, byte[] utf8Data, int offset, int length)
      Called for fields which are available as UTF-8 instead of accept(String, Object).
      void accept​(java.lang.String name, java.lang.Object value)  
      protected void renderFieldContents​(java.lang.Object field)  
      protected boolean shouldRender​(java.lang.String name, java.lang.Object value)  
      protected boolean shouldRenderUtf8Value​(java.lang.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

    • Constructor Detail

      • FieldConsumer

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

      • accept

        public void accept​(java.lang.String name,
                           java.lang.Object value)
        Specified by:
        accept in interface java.util.function.BiConsumer<java.lang.String,​java.lang.Object>
      • accept

        public void accept​(java.lang.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
        name - the name of the field
        utf8Data - raw utf-8 data. The reciver 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​(java.lang.String name,
                                       java.lang.Object value)
      • shouldRenderUtf8Value

        protected boolean shouldRenderUtf8Value​(java.lang.String name,
                                                int length)
      • renderFieldContents

        protected void renderFieldContents​(java.lang.Object field)
      • accept

        public void accept​(java.lang.Object field)
        Specified by:
        accept in interface