org.milyn.edi.unedifact.d96a.common.GoodsItemDetails 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 org.milyn.edi.unedifact.d96a.common.field.NumberAndTypeOfPackagesC213;
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 GoodsItemDetails implements Serializable, EDIWritable {
private static final long serialVersionUID = 1L;
private BigDecimal goodsItemNumber;
private DABigDecimalDecoder goodsItemNumberEncoder;
private NumberAndTypeOfPackagesC213 numberAndTypeOfPackages1;
private NumberAndTypeOfPackagesC213 numberAndTypeOfPackages2;
private NumberAndTypeOfPackagesC213 numberAndTypeOfPackages3;
public GoodsItemDetails() {
goodsItemNumberEncoder = new DABigDecimalDecoder();
}
public void write(Writer writer, Delimiters delimiters) throws IOException {
Writer nodeWriter = new StringWriter();
List nodeTokens = new ArrayList();
if(goodsItemNumber != null) {
nodeWriter.write(delimiters.escape(goodsItemNumberEncoder.encode(goodsItemNumber, delimiters)));
nodeTokens.add(nodeWriter.toString());
((StringWriter)nodeWriter).getBuffer().setLength(0);
}
nodeWriter.write(delimiters.getField());
if(numberAndTypeOfPackages1 != null) {
numberAndTypeOfPackages1.write(nodeWriter, delimiters);
nodeTokens.add(nodeWriter.toString());
((StringWriter)nodeWriter).getBuffer().setLength(0);
}
nodeWriter.write(delimiters.getField());
if(numberAndTypeOfPackages2 != null) {
numberAndTypeOfPackages2.write(nodeWriter, delimiters);
nodeTokens.add(nodeWriter.toString());
((StringWriter)nodeWriter).getBuffer().setLength(0);
}
nodeWriter.write(delimiters.getField());
if(numberAndTypeOfPackages3 != null) {
numberAndTypeOfPackages3.write(nodeWriter, 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 BigDecimal getGoodsItemNumber() {
return goodsItemNumber;
}
public GoodsItemDetails setGoodsItemNumber(BigDecimal goodsItemNumber) {
this.goodsItemNumber = goodsItemNumber; return this;
}
public NumberAndTypeOfPackagesC213 getNumberAndTypeOfPackages1() {
return numberAndTypeOfPackages1;
}
public GoodsItemDetails setNumberAndTypeOfPackages1(NumberAndTypeOfPackagesC213 numberAndTypeOfPackages1) {
this.numberAndTypeOfPackages1 = numberAndTypeOfPackages1; return this;
}
public NumberAndTypeOfPackagesC213 getNumberAndTypeOfPackages2() {
return numberAndTypeOfPackages2;
}
public GoodsItemDetails setNumberAndTypeOfPackages2(NumberAndTypeOfPackagesC213 numberAndTypeOfPackages2) {
this.numberAndTypeOfPackages2 = numberAndTypeOfPackages2; return this;
}
public NumberAndTypeOfPackagesC213 getNumberAndTypeOfPackages3() {
return numberAndTypeOfPackages3;
}
public GoodsItemDetails setNumberAndTypeOfPackages3(NumberAndTypeOfPackagesC213 numberAndTypeOfPackages3) {
this.numberAndTypeOfPackages3 = numberAndTypeOfPackages3; return this;
}
}