
com.vendasta.accountgroup.v1.internal.ContactDetails 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.ApiProto;
/**
*
**/
public final class ContactDetails {
private final String firstName;
private final String lastName;
private final String email;
private final String phoneNumber;
private ContactDetails (
final String firstName,
final String lastName,
final String email,
final String phoneNumber)
{
this.firstName = firstName;
this.lastName = lastName;
this.email = email;
this.phoneNumber = phoneNumber;
}
/**
*
* @return The final value of firstName on the object
**/
public String getFirstName() {
return this.firstName;
}
/**
*
* @return The final value of lastName on the object
**/
public String getLastName() {
return this.lastName;
}
/**
*
* @return The final value of email on the object
**/
public String getEmail() {
return this.email;
}
/**
*
* @return The final value of phoneNumber on the object
**/
public String getPhoneNumber() {
return this.phoneNumber;
}
public static class Builder {
private String firstName;
private String lastName;
private String email;
private String phoneNumber;
public Builder() {
this.firstName = "";
this.lastName = "";
this.email = "";
this.phoneNumber = "";
}
/**
* Adds a value to the builder for firstName
* @param firstName Value to assign to the mutable Builder
* @return The Builder instance so that call chaining works
**/
public Builder setFirstName(String firstName) {
this.firstName = firstName;
return this;
}
/**
* Adds a value to the builder for lastName
* @param lastName Value to assign to the mutable Builder
* @return The Builder instance so that call chaining works
**/
public Builder setLastName(String lastName) {
this.lastName = lastName;
return this;
}
/**
* Adds a value to the builder for email
* @param email Value to assign to the mutable Builder
* @return The Builder instance so that call chaining works
**/
public Builder setEmail(String email) {
this.email = email;
return this;
}
/**
* Adds a value to the builder for phoneNumber
* @param phoneNumber Value to assign to the mutable Builder
* @return The Builder instance so that call chaining works
**/
public Builder setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
return this;
}
/**
* Takes the configuration in the mutable Builder and uses it to instantiate a final instance
* of the ContactDetails class
* @return The instantiated final ContactDetails
**/
public ContactDetails build() {
return new ContactDetails(
this.firstName,
this.lastName,
this.email,
this.phoneNumber);
}
}
/**
* Returns a Builder for ContactDetails, which is a mutable representation of the object. Once the
* client has built up an object they can then create an immutable ContactDetails 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 ContactDetails instance
**/
public String toString() {
String result = "ContactDetails\n";
result += "-> firstName: (String)"
+ StringUtils.join("\n ", Arrays.asList(String.valueOf(this.firstName).split("\n"))) + "\n";
result += "-> lastName: (String)"
+ StringUtils.join("\n ", Arrays.asList(String.valueOf(this.lastName).split("\n"))) + "\n";
result += "-> email: (String)"
+ StringUtils.join("\n ", Arrays.asList(String.valueOf(this.email).split("\n"))) + "\n";
result += "-> phoneNumber: (String)"
+ StringUtils.join("\n ", Arrays.asList(String.valueOf(this.phoneNumber).split("\n"))) + "\n";
return result;
}
/**
* Allows for simple conversion between the low-level generated protobuf object to
* ContactDetails, which is much more usable.
* @return An instance of ContactDetails representing the input proto object
**/
public static ContactDetails fromProto(ApiProto.ContactDetails proto) {
ContactDetails out = null;
if (proto != null) {
ContactDetails.Builder outBuilder = ContactDetails.newBuilder()
.setFirstName(proto.getFirstName())
.setLastName(proto.getLastName())
.setEmail(proto.getEmail())
.setPhoneNumber(proto.getPhoneNumber());
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 ContactDetails instances representing the input proto objects
**/
public static List fromProtos(List protos) {
List out = new ArrayList();
for(ApiProto.ContactDetails proto : protos) {
out.add(ContactDetails.fromProto(proto));
}
return out;
}
/**
* Allows for simple conversion of an object to the low-level generated protobuf object.
* @return An instance of ApiProto.ContactDetails which is a proto object ready for wire transmission
**/
public ApiProto.ContactDetails toProto() {
ContactDetails obj = this;
ApiProto.ContactDetails.Builder outBuilder = ApiProto.ContactDetails.newBuilder();
outBuilder.setFirstName(obj.getFirstName());
outBuilder.setLastName(obj.getLastName());
outBuilder.setEmail(obj.getEmail());
outBuilder.setPhoneNumber(obj.getPhoneNumber());
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 ApiProto.ContactDetails instances representing the input objects.
*/
public static List toProtos(List objects) {
List out = new ArrayList();
if(objects != null) {
for (ContactDetails obj : objects) {
out.add(obj!=null?obj.toProto():null);
}
}
return out;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy