
com.vendasta.accountgroup.v1.internal.AddressInfo Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of accountgroup.v1 Show documentation
Show all versions of accountgroup.v1 Show documentation
Java SDK for service account-group
The newest version!
package com.vendasta.accountgroup.v1.internal;
import java.util.List;
import java.util.ArrayList;
import java.util.Date;
import java.util.Map;
import java.util.HashMap;
import java.util.Collections;
import java.util.Arrays;
import java.time.Duration;
import org.apache.commons.lang3.StringUtils;
import com.vendasta.accountgroup.v1.generated.AccountValidationProto;
/**
*
**/
public final class AddressInfo {
private final String address;
private final String address2;
private final String country;
private final String city;
private final String state;
private final String zip;
private final List footnotes;
private AddressInfo (
final String address,
final String address2,
final String country,
final String city,
final String state,
final String zip,
final List footnotes)
{
this.address = address;
this.address2 = address2;
this.country = country;
this.city = city;
this.state = state;
this.zip = zip;
this.footnotes = footnotes;
}
/**
* Address line 1
* @return The final value of address on the object
**/
public String getAddress() {
return this.address;
}
/**
* Address line 2
* @return The final value of address2 on the object
**/
public String getAddress2() {
return this.address2;
}
/**
*
* @return The final value of country on the object
**/
public String getCountry() {
return this.country;
}
/**
*
* @return The final value of city on the object
**/
public String getCity() {
return this.city;
}
/**
*
* @return The final value of state on the object
**/
public String getState() {
return this.state;
}
/**
*
* @return The final value of zip on the object
**/
public String getZip() {
return this.zip;
}
/**
* List of Human readable changes SmartyStreets made to the address
* @return The final value of footnotes on the object
**/
public List getFootnotes() {
return this.footnotes;
}
public static class Builder {
private String address;
private String address2;
private String country;
private String city;
private String state;
private String zip;
private List footnotes;
public Builder() {
this.address = "";
this.address2 = "";
this.country = "";
this.city = "";
this.state = "";
this.zip = "";
this.footnotes = new ArrayList();
}
/**
* Adds a value to the builder for address
* @param address Value to assign to the mutable Builder
* @return The Builder instance so that call chaining works
**/
public Builder setAddress(String address) {
this.address = address;
return this;
}
/**
* Adds a value to the builder for address2
* @param address2 Value to assign to the mutable Builder
* @return The Builder instance so that call chaining works
**/
public Builder setAddress2(String address2) {
this.address2 = address2;
return this;
}
/**
* Adds a value to the builder for country
* @param country Value to assign to the mutable Builder
* @return The Builder instance so that call chaining works
**/
public Builder setCountry(String country) {
this.country = country;
return this;
}
/**
* Adds a value to the builder for city
* @param city Value to assign to the mutable Builder
* @return The Builder instance so that call chaining works
**/
public Builder setCity(String city) {
this.city = city;
return this;
}
/**
* Adds a value to the builder for state
* @param state Value to assign to the mutable Builder
* @return The Builder instance so that call chaining works
**/
public Builder setState(String state) {
this.state = state;
return this;
}
/**
* Adds a value to the builder for zip
* @param zip Value to assign to the mutable Builder
* @return The Builder instance so that call chaining works
**/
public Builder setZip(String zip) {
this.zip = zip;
return this;
}
/**
* Adds a value to the builder for footnotes
* @param footnotes Value to assign to the mutable Builder
* @return The Builder instance so that call chaining works
**/
public Builder setFootnotes(List footnotes) {
this.footnotes = footnotes;
return this;
}
/**
* Takes the configuration in the mutable Builder and uses it to instantiate a final instance
* of the AddressInfo class
* @return The instantiated final AddressInfo
**/
public AddressInfo build() {
return new AddressInfo(
this.address,
this.address2,
this.country,
this.city,
this.state,
this.zip,
this.footnotes);
}
}
/**
* Returns a Builder for AddressInfo, which is a mutable representation of the object. Once the
* client has built up an object they can then create an immutable AddressInfo object using the
* build function.
* @return A fresh Builder instance with no values set
**/
public static Builder newBuilder() {
return new Builder();
}
/**
* Provides a human-readable representation of this object. Useful for debugging.
* @return A string representation of the AddressInfo instance
**/
public String toString() {
String result = "AddressInfo\n";
result += "-> address: (String)"
+ StringUtils.join("\n ", Arrays.asList(String.valueOf(this.address).split("\n"))) + "\n";
result += "-> address2: (String)"
+ StringUtils.join("\n ", Arrays.asList(String.valueOf(this.address2).split("\n"))) + "\n";
result += "-> country: (String)"
+ StringUtils.join("\n ", Arrays.asList(String.valueOf(this.country).split("\n"))) + "\n";
result += "-> city: (String)"
+ StringUtils.join("\n ", Arrays.asList(String.valueOf(this.city).split("\n"))) + "\n";
result += "-> state: (String)"
+ StringUtils.join("\n ", Arrays.asList(String.valueOf(this.state).split("\n"))) + "\n";
result += "-> zip: (String)"
+ StringUtils.join("\n ", Arrays.asList(String.valueOf(this.zip).split("\n"))) + "\n";
result += "-> footnotes: (List)"
+ StringUtils.join("\n ", Arrays.asList(String.valueOf(this.footnotes).split("\n"))) + "\n";
return result;
}
/**
* Allows for simple conversion between the low-level generated protobuf object to
* AddressInfo, which is much more usable.
* @return An instance of AddressInfo representing the input proto object
**/
public static AddressInfo fromProto(AccountValidationProto.AddressInfo proto) {
AddressInfo out = null;
if (proto != null) {
AddressInfo.Builder outBuilder = AddressInfo.newBuilder()
.setAddress(proto.getAddress())
.setAddress2(proto.getAddress2())
.setCountry(proto.getCountry())
.setCity(proto.getCity())
.setState(proto.getState())
.setZip(proto.getZip())
.setFootnotes(proto.getFootnotesList());
out = outBuilder.build();
}
return out;
}
/**
* Convenience method for handling lists of proto objects. It calls .fromProto on each one
* and returns a list of the converted results.
* @return A list of AddressInfo instances representing the input proto objects
**/
public static List fromProtos(List protos) {
List out = new ArrayList();
for(AccountValidationProto.AddressInfo proto : protos) {
out.add(AddressInfo.fromProto(proto));
}
return out;
}
/**
* Allows for simple conversion of an object to the low-level generated protobuf object.
* @return An instance of AccountValidationProto.AddressInfo which is a proto object ready for wire transmission
**/
public AccountValidationProto.AddressInfo toProto() {
AddressInfo obj = this;
AccountValidationProto.AddressInfo.Builder outBuilder = AccountValidationProto.AddressInfo.newBuilder();
outBuilder.setAddress(obj.getAddress());
outBuilder.setAddress2(obj.getAddress2());
outBuilder.setCountry(obj.getCountry());
outBuilder.setCity(obj.getCity());
outBuilder.setState(obj.getState());
outBuilder.setZip(obj.getZip());
outBuilder.addAllFootnotes(obj.getFootnotes());
return outBuilder.build();
}
/**
* Convenience method for handling lists of objects. It calls .toProto on each one and
* returns a list of the converted results.
* @return A list of AccountValidationProto.AddressInfo instances representing the input objects.
*/
public static List toProtos(List objects) {
List out = new ArrayList();
if(objects != null) {
for (AddressInfo obj : objects) {
out.add(obj!=null?obj.toProto():null);
}
}
return out;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy