All Downloads are FREE. Search and download functionalities are using the official Maven repository.

br.com.objectos.jabuticava.serasa.relato.factoring.ChequeNumeroParser Maven / Gradle / Ivy

The newest version!
package br.com.objectos.jabuticava.serasa.relato.factoring;

import br.com.objectos.way.io.flat.FlatFileReader;
import br.com.objectos.way.io.flat.Record;
import br.com.objectos.way.io.flat.RecordParseException;
import br.com.objectos.way.io.flat.RecordParser;
import br.com.objectos.way.io.flat.pojo.IntegerOption;
import javax.annotation.Generated;

@Generated("br.com.objectos.way.io.flat.FlatRecordPlugin")
final class ChequeNumeroParser implements RecordParser {
  private static final ChequeNumeroParser INSTANCE = new ChequeNumeroParser();

  private static final String filler0 = "0000";

  private static final String filler1 = "00";

  private static final String filler2 = "0";

  private static final String filler3 = "  ";

  private ChequeNumeroParser() {
  }

  public static RecordParser get() {
    return INSTANCE;
  }

  @Override
  public ChequeNumero parse(FlatFileReader file) throws RecordParseException {
    Record record = file.recordReader()
        .integer(3, IntegerOption.ZEROFILL)
        .integer(4, IntegerOption.ZEROFILL)
        .fixed(filler0)
        .integer(6, IntegerOption.ZEROFILL)
        .fixed(filler1)
        .integer(10, IntegerOption.ZEROFILL)
        .fixed(filler2)
        .fixed(filler3)
        .read();

    if (!record.valid()) {
      throw record.parseException();
    }

    return new ChequeNumeroBuilderPojo()
        .banco(record.intValue())
        .agencia(record.intValue())
        .numero(record.intValue())
        .conta(record.intValue())
        .build();
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy