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

br.com.objectos.jabuticava.serasa.relato.factoring.ErroParser 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.RecordMatcher;
import br.com.objectos.way.io.flat.RecordParseException;
import br.com.objectos.way.io.flat.RecordParser;
import javax.annotation.Generated;

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

  private static final String id = "88";

  private static final String brancos0 = "  ";

  private static final String brancos1 = " ";

  private static final String brancos2 = "                                                                                                                      ";

  private ErroParser() {
  }

  public static RecordParser get() {
    return INSTANCE;
  }

  public static RecordMatcher getMatcher() {
    return INSTANCE;
  }

  @Override
  public boolean matches(String line) {
    return line != null ? line.startsWith("88") : false;
  }

  @Override
  public Erro parse(FlatFileReader file) throws RecordParseException {
    Record record = file.recordReader()
        .fixed(id)
        .integer(3)
        .fixed(brancos0)
        .text(55)
        .fixed(brancos1)
        .integer(9)
        .fixed(brancos2)
        .read();

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

    return new ErroBuilderPojo()
        .numero(record.intValue())
        .descricao(record. get())
        .quantidade(record.intValue())
        .build();
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy