com.mindee.product.billoflading.BillOfLadingV1Shipper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mindee-api-java Show documentation
Show all versions of mindee-api-java Show documentation
Java Library to call Mindee's Off-The-Shelf and Custom APIs
The newest version!
package com.mindee.product.billoflading;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.mindee.parsing.SummaryHelper;
import com.mindee.parsing.standard.BaseField;
import java.util.HashMap;
import java.util.Map;
import lombok.Getter;
/**
* The party responsible for shipping the goods.
*/
@Getter
@JsonIgnoreProperties(ignoreUnknown = true)
public class BillOfLadingV1Shipper extends BaseField {
/**
* The address of the shipper.
*/
@JsonProperty("address")
String address;
/**
* The email of the shipper.
*/
@JsonProperty("email")
String email;
/**
* The name of the shipper.
*/
@JsonProperty("name")
String name;
/**
* The phone number of the shipper.
*/
@JsonProperty("phone")
String phone;
public boolean isEmpty() {
return (
(address == null || address.isEmpty())
&& (email == null || email.isEmpty())
&& (name == null || name.isEmpty())
&& (phone == null || phone.isEmpty())
);
}
/**
* Output the object in a format suitable for inclusion in an rST field list.
*/
public String toFieldList() {
Map printable = this.printableValues();
return String.format(" :Address: %s%n", printable.get("address"))
+ String.format(" :Email: %s%n", printable.get("email"))
+ String.format(" :Name: %s%n", printable.get("name"))
+ String.format(" :Phone: %s%n", printable.get("phone"));
}
@Override
public String toString() {
Map printable = this.printableValues();
return String.format("Address: %s", printable.get("address"))
+ String.format(", Email: %s", printable.get("email"))
+ String.format(", Name: %s", printable.get("name"))
+ String.format(", Phone: %s", printable.get("phone"));
}
private Map printableValues() {
Map printable = new HashMap<>();
printable.put("address", SummaryHelper.formatForDisplay(this.address, null));
printable.put("email", SummaryHelper.formatForDisplay(this.email, null));
printable.put("name", SummaryHelper.formatForDisplay(this.name, null));
printable.put("phone", SummaryHelper.formatForDisplay(this.phone, null));
return printable;
}
}