All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.vendasta.accountgroup.v1.internal.GetMultiResponse Maven / Gradle / Ivy

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;

/**
 * 
 **/
public final class GetMultiResponse {



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

	private final List accountGroups;
	

	private GetMultiResponse (
		final List accountGroups)
		
	{
		this.accountGroups = accountGroups;
		
	}
	
	/**
	 * 
      * @return The final value of accountGroups on the object
	 **/
	public List getAccountGroups() {
		return this.accountGroups;
	}
	

	public static class Builder {
		private List accountGroups;
		
		public Builder() {
			this.accountGroups = null;
			
		}
		
		/**
		  * Adds a value to the builder for accountGroups
		  * @param accountGroups Value to assign to the mutable Builder
		  * @return The Builder instance so that call chaining works
		 **/
		public Builder setAccountGroups(List accountGroups) {
			this.accountGroups = accountGroups;
			return this;
		}
		
		/**
		  * Takes the configuration in the mutable Builder and uses it to instantiate a final instance
		  * of the GetMultiResponse class
		  * @return The instantiated final GetMultiResponse
		 **/
		public GetMultiResponse build() {
			return new GetMultiResponse(
				this.accountGroups);
		}
	}

	/**
	 * Returns a Builder for GetMultiResponse, which is a mutable representation of the object.  Once the
	 * client has built up an object they can then create an immutable GetMultiResponse 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 GetMultiResponse instance
	 **/
	 public String toString() {
		 String result = "GetMultiResponse\n";
		 result += "-> accountGroups: (List)"
		     + StringUtils.join("\n  ", Arrays.asList(String.valueOf(this.accountGroups).split("\n"))) + "\n"; 
		 
		 return result;
	 }
	/**
	* Allows for simple conversion between the low-level generated protobuf object to
	* GetMultiResponse, which is much more usable.
	* @return An instance of GetMultiResponse representing the input proto object
	**/
	public static GetMultiResponse fromProto(ApiProto.GetMultiResponse proto) {
		GetMultiResponse out = null;
		if (proto != null) {
			GetMultiResponse.Builder outBuilder = GetMultiResponse.newBuilder()
			.setAccountGroups(GetMultiResponse.AccountGroupContainer.fromProtos(proto.getAccountGroupsList()));
			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 GetMultiResponse instances representing the input proto objects
	**/
	public static List fromProtos(List protos) {
		List out = new ArrayList();
		for(ApiProto.GetMultiResponse proto : protos) {
			out.add(GetMultiResponse.fromProto(proto));
		}
		return out;
	}

	/**
	 * Allows for simple conversion of an object to the low-level generated protobuf object.
	 * @return An instance of ApiProto.GetMultiResponse which is a proto object ready for wire transmission
	 **/
	 public ApiProto.GetMultiResponse toProto() {
		 GetMultiResponse obj = this;
		 ApiProto.GetMultiResponse.Builder outBuilder = ApiProto.GetMultiResponse.newBuilder();
		 outBuilder.addAllAccountGroups(GetMultiResponse.AccountGroupContainer.toProtos(obj.getAccountGroups()));
		 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.GetMultiResponse instances representing the input objects.
	  */
	public static List toProtos(List objects) {
		List out = new ArrayList();
		if(objects != null) {
			for (GetMultiResponse obj : objects) {
				out.add(obj!=null?obj.toProto():null);
			}
		}
		return out;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy