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