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