org.milyn.edi.unedifact.d96a.common.DocumentMessageSummary Maven / Gradle / Ivy
/**
* This class was generated by Smooks EJC (http://www.smooks.org).
*/
package org.milyn.edi.unedifact.d96a.common;
import java.io.Serializable;
import org.milyn.smooks.edi.EDIWritable;
import java.math.BigDecimal;
import org.milyn.javabean.decoders.DABigDecimalDecoder;
import java.io.Writer;
import org.milyn.edisax.model.internal.Delimiters;
import java.io.IOException;
import java.io.StringWriter;
import java.util.List;
import java.util.ArrayList;
import org.milyn.edisax.util.EDIUtils;
import org.milyn.edisax.model.internal.DelimiterType;
public class DocumentMessageSummary implements Serializable, EDIWritable {
private static final long serialVersionUID = 1L;
private String documentMessageNumber;
private String documentMessageNameCoded;
private BigDecimal totalNumberOfItems;
private DABigDecimalDecoder totalNumberOfItemsEncoder;
public DocumentMessageSummary() {
totalNumberOfItemsEncoder = new DABigDecimalDecoder();
}
public void write(Writer writer, Delimiters delimiters) throws IOException {
Writer nodeWriter = new StringWriter();
List nodeTokens = new ArrayList();
if(documentMessageNumber != null) {
nodeWriter.write(delimiters.escape(documentMessageNumber.toString()));
nodeTokens.add(nodeWriter.toString());
((StringWriter)nodeWriter).getBuffer().setLength(0);
}
nodeWriter.write(delimiters.getField());
if(documentMessageNameCoded != null) {
nodeWriter.write(delimiters.escape(documentMessageNameCoded.toString()));
nodeTokens.add(nodeWriter.toString());
((StringWriter)nodeWriter).getBuffer().setLength(0);
}
nodeWriter.write(delimiters.getField());
if(totalNumberOfItems != null) {
nodeWriter.write(delimiters.escape(totalNumberOfItemsEncoder.encode(totalNumberOfItems, delimiters)));
nodeTokens.add(nodeWriter.toString());
((StringWriter)nodeWriter).getBuffer().setLength(0);
}
nodeTokens.add(nodeWriter.toString());
writer.write(EDIUtils.concatAndTruncate(nodeTokens, DelimiterType.FIELD, delimiters));
writer.write(delimiters.getSegmentDelimiter());
writer.flush();
}
public String getDocumentMessageNumber() {
return documentMessageNumber;
}
public DocumentMessageSummary setDocumentMessageNumber(String documentMessageNumber) {
this.documentMessageNumber = documentMessageNumber; return this;
}
public String getDocumentMessageNameCoded() {
return documentMessageNameCoded;
}
public DocumentMessageSummary setDocumentMessageNameCoded(String documentMessageNameCoded) {
this.documentMessageNameCoded = documentMessageNameCoded; return this;
}
public BigDecimal getTotalNumberOfItems() {
return totalNumberOfItems;
}
public DocumentMessageSummary setTotalNumberOfItems(BigDecimal totalNumberOfItems) {
this.totalNumberOfItems = totalNumberOfItems; return this;
}
}