Package org.bigk.invoices.model.builder

Source Code of org.bigk.invoices.model.builder.PurchaserBuilder

package org.bigk.invoices.model.builder;

import org.bigk.invoices.model.Purchaser;

public class PurchaserBuilder {

  private Long id;
  private String name;
  private String address;
  private String nip;

  private PurchaserBuilder() {}
 
  public PurchaserBuilder withId(Long id) {
    this.id = id;
    return this;
  }

  public PurchaserBuilder withName(String name) {
    this.name = name;
    return this;
  }

  public PurchaserBuilder withAddress(String address) {
    this.address = address;
    return this;
  }

  public PurchaserBuilder withNip(String nip) {
    this.nip = nip;
    return this;
  }

  public Purchaser build() {
    Purchaser purchaser = new Purchaser();
    purchaser.setId(this.id);
    purchaser.setName(this.name);
    purchaser.setAddress(this.address);
    purchaser.setNip(this.nip);
    return purchaser;
  }
 
  public static PurchaserBuilder aPurchaser() {
    return new PurchaserBuilder();
  }
}
TOP

Related Classes of org.bigk.invoices.model.builder.PurchaserBuilder

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.