
com.vendasta.sales.v1.internal.UserActionsRequest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sales.v1 Show documentation
Show all versions of sales.v1 Show documentation
Java SDK for service sales
The newest version!
package com.vendasta.sales.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 org.apache.commons.lang3.StringUtils;
import com.vendasta.sales.v1.generated.UserActionsProto;
/**
*
**/
public final class UserActionsRequest {
private final String accountGroupId;
private final ActionCategory category;
private final String description;
private UserActionsRequest (
final String accountGroupId,
final ActionCategory category,
final String description)
{
this.accountGroupId = accountGroupId;
this.category = category;
this.description = description;
}
/**
* The account group that the action is associated with
* @return The final value of accountGroupId on the object
**/
public String getAccountGroupId() {
return this.accountGroupId;
}
/**
* The category that the action is included in
* @return The final value of category on the object
**/
public ActionCategory getCategory() {
return this.category;
}
/**
* The description of the event that occurred
* @return The final value of description on the object
**/
public String getDescription() {
return this.description;
}
public static class Builder {
private String accountGroupId;
private ActionCategory category;
private String description;
public Builder() {
this.accountGroupId = "";
this.category = null;
this.description = "";
}
/**
* 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 category
* @param category Value to assign to the mutable Builder
* @return The Builder instance so that call chaining works
**/
public Builder setCategory(ActionCategory category) {
this.category = category;
return this;
}
/**
* Adds a value to the builder for description
* @param description Value to assign to the mutable Builder
* @return The Builder instance so that call chaining works
**/
public Builder setDescription(String description) {
this.description = description;
return this;
}
/**
* Takes the configuration in the mutable Builder and uses it to instantiate a final instance
* of the UserActionsRequest class
* @return The instantiated final UserActionsRequest
**/
public UserActionsRequest build() {
return new UserActionsRequest(
this.accountGroupId,
this.category,
this.description);
}
}
/**
* Returns a Builder for UserActionsRequest, which is a mutable representation of the object. Once the
* client has built up an object they can then create an immutable UserActionsRequest 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 UserActionsRequest instance
**/
public String toString() {
String result = "UserActionsRequest\n";
result += "-> accountGroupId: (String)"
+ StringUtils.join("\n ", Arrays.asList(String.valueOf(this.accountGroupId).split("\n"))) + "\n";
result += "-> category: (ActionCategory)"
+ StringUtils.join("\n ", Arrays.asList(String.valueOf(this.category).split("\n"))) + "\n";
result += "-> description: (String)"
+ StringUtils.join("\n ", Arrays.asList(String.valueOf(this.description).split("\n"))) + "\n";
return result;
}
/**
* Allows for simple conversion between the low-level generated protobuf object to
* UserActionsRequest, which is much more usable.
* @return An instance of UserActionsRequest representing the input proto object
**/
public static UserActionsRequest fromProto(UserActionsProto.UserActionsRequest proto) {
UserActionsRequest out = null;
if (proto != null) {
UserActionsRequest.Builder outBuilder = UserActionsRequest.newBuilder()
.setAccountGroupId(proto.getAccountGroupId())
.setCategory(ActionCategory.fromProto(proto.getCategory()))
.setDescription(proto.getDescription());
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 UserActionsRequest instances representing the input proto objects
**/
public static List fromProtos(List protos) {
List out = new ArrayList();
for(UserActionsProto.UserActionsRequest proto : protos) {
out.add(UserActionsRequest.fromProto(proto));
}
return out;
}
/**
* Allows for simple conversion of an object to the low-level generated protobuf object.
* @return An instance of UserActionsProto.UserActionsRequest which is a proto object ready for wire transmission
**/
public UserActionsProto.UserActionsRequest toProto() {
UserActionsRequest obj = this;
UserActionsProto.UserActionsRequest.Builder outBuilder = UserActionsProto.UserActionsRequest.newBuilder();
outBuilder.setAccountGroupId(obj.getAccountGroupId());
outBuilder.setCategory(obj.getCategory() != null?obj.getCategory().toProto():null);
outBuilder.setDescription(obj.getDescription());
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 UserActionsProto.UserActionsRequest instances representing the input objects.
*/
public static List toProtos(List objects) {
List out = new ArrayList();
if(objects != null) {
for (UserActionsRequest obj : objects) {
out.add(obj!=null?obj.toProto():null);
}
}
return out;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy