Class RecordConsumer

  • Direct Known Subclasses:
    RecordConsumerLoggingWrapper, ValidatingRecordConsumer

    public abstract class RecordConsumer
    extends Object
    Abstraction for writing records It decouples the striping algorithm from the actual record model example:
     startMessage()
      startField("A", 0)
       addValue(1)
       addValue(2)
      endField("A", 0)
      startField("B", 1)
       startGroup()
        startField("C", 0)
         addValue(3)
        endField("C", 0)
       endGroup()
      endField("B", 1)
     endMessage()
     
    would produce the following message:
     {
       A: [1, 2]
       B: {
         C: 3
       }
     }
     
    • Constructor Summary

      Constructors 
      Constructor Description
      RecordConsumer()  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract void addBinary​(Binary value)
      add a binary value in the current field
      abstract void addBoolean​(boolean value)
      add a boolean value in the current field
      abstract void addDouble​(double value)
      add a double value in the current field
      abstract void addFloat​(float value)
      add a float value in the current field
      abstract void addInteger​(int value)
      add an int value in the current field
      abstract void addLong​(long value)
      add a long value in the current field
      abstract void endField​(String field, int index)
      end of a field in a group or message
      abstract void endGroup()
      end of a group in a field
      abstract void endMessage()
      end of a record
      void flush()
      NoOps by default Subclass class can implement its own flushing logic
      abstract void startField​(String field, int index)
      start of a field in a group or message if the field is repeated the field is started only once and all values added in between start and end
      abstract void startGroup()
      start of a group in a field
      abstract void startMessage()
      start a new record
    • Constructor Detail

      • RecordConsumer

        public RecordConsumer()
    • Method Detail

      • startMessage

        public abstract void startMessage()
        start a new record
      • endMessage

        public abstract void endMessage()
        end of a record
      • startField

        public abstract void startField​(String field,
                                        int index)
        start of a field in a group or message if the field is repeated the field is started only once and all values added in between start and end
        Parameters:
        field - name of the field
        index - of the field in the group or message
      • endField

        public abstract void endField​(String field,
                                      int index)
        end of a field in a group or message
        Parameters:
        field - name of the field
        index - of the field in the group or message
      • startGroup

        public abstract void startGroup()
        start of a group in a field
      • endGroup

        public abstract void endGroup()
        end of a group in a field
      • addInteger

        public abstract void addInteger​(int value)
        add an int value in the current field
        Parameters:
        value - an int value
      • addLong

        public abstract void addLong​(long value)
        add a long value in the current field
        Parameters:
        value - a long value
      • addBoolean

        public abstract void addBoolean​(boolean value)
        add a boolean value in the current field
        Parameters:
        value - a boolean value
      • addBinary

        public abstract void addBinary​(Binary value)
        add a binary value in the current field
        Parameters:
        value - a binary value
      • addFloat

        public abstract void addFloat​(float value)
        add a float value in the current field
        Parameters:
        value - a float value
      • addDouble

        public abstract void addDouble​(double value)
        add a double value in the current field
        Parameters:
        value - a double value
      • flush

        public void flush()
        NoOps by default Subclass class can implement its own flushing logic