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