Class BitmappedCodecBuilder<T extends Bitmapped>

java.lang.Object
io.bytestreams.codec.iso8583.BitmappedCodecBuilder<T>
Type Parameters:
T - the bitmapped object type

public class BitmappedCodecBuilder<T extends Bitmapped> extends Object
A two-phase builder for constructing an SequentialObjectCodec over a Bitmapped object.

Phase 1 (BitmappedCodecBuilder): add non-optional fields and then the bitmap field. Phase 2 (DataFieldBuilder): add bitmap-driven data fields and build.

  • Method Details

    • builder

      public static <T extends Bitmapped> BitmappedCodecBuilder<T> builder(Supplier<T> factory)
      Creates a new builder.
      Type Parameters:
      T - the bitmapped object type
      Parameters:
      factory - supplier that creates new instances during decoding
      Returns:
      a new builder
    • field

      public <V> BitmappedCodecBuilder<T> field(io.bytestreams.codec.core.FieldSpec<T,V> spec)
      Adds a non-optional field before the bitmap.
      Type Parameters:
      V - the field value type
      Parameters:
      spec - the field specification
      Returns:
      this builder
    • bitmap

      public <B extends Bitmap> BitmappedCodecBuilder.DataFieldBuilder<T> bitmap(io.bytestreams.codec.core.FieldSpec<T,B> spec)
      Adds the bitmap field and transitions to the data field phase.
      Type Parameters:
      B - the bitmap type
      Parameters:
      spec - the bitmap field specification
      Returns:
      a BitmappedCodecBuilder.DataFieldBuilder for adding data fields