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