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