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

com.vendasta.accountgroup.v1.internal.GetMultiRequest 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 GetMultiRequest {




	private final List accountGroupIds;
	private final ProjectionFilter projectionFilter;
	private final ReadFilter readFilter;
	

	private GetMultiRequest (
		final List accountGroupIds,
		final ProjectionFilter projectionFilter,
		final ReadFilter readFilter)
		
	{
		this.accountGroupIds = accountGroupIds;
		this.projectionFilter = projectionFilter;
		this.readFilter = readFilter;
		
	}
	
	/**
	 * 
      * @return The final value of accountGroupIds on the object
	 **/
	public List getAccountGroupIds() {
		return this.accountGroupIds;
	}
	
	/**
	 * 
      * @return The final value of projectionFilter on the object
	 **/
	public ProjectionFilter getProjectionFilter() {
		return this.projectionFilter;
	}
	
	/**
	 * 
      * @return The final value of readFilter on the object
	 **/
	public ReadFilter getReadFilter() {
		return this.readFilter;
	}
	

	public static class Builder {
		private List accountGroupIds;
		private ProjectionFilter projectionFilter;
		private ReadFilter readFilter;
		
		public Builder() {
			this.accountGroupIds = new ArrayList();
			this.projectionFilter = null;
			this.readFilter = null;
			
		}
		
		/**
		  * Adds a value to the builder for accountGroupIds
		  * @param accountGroupIds Value to assign to the mutable Builder
		  * @return The Builder instance so that call chaining works
		 **/
		public Builder setAccountGroupIds(List accountGroupIds) {
			this.accountGroupIds = accountGroupIds;
			return this;
		}
		
		/**
		  * Adds a value to the builder for projectionFilter
		  * @param projectionFilter Value to assign to the mutable Builder
		  * @return The Builder instance so that call chaining works
		 **/
		public Builder setProjectionFilter(ProjectionFilter projectionFilter) {
			this.projectionFilter = projectionFilter;
			return this;
		}
		
		/**
		  * Adds a value to the builder for readFilter
		  * @param readFilter Value to assign to the mutable Builder
		  * @return The Builder instance so that call chaining works
		 **/
		public Builder setReadFilter(ReadFilter readFilter) {
			this.readFilter = readFilter;
			return this;
		}
		
		/**
		  * Takes the configuration in the mutable Builder and uses it to instantiate a final instance
		  * of the GetMultiRequest class
		  * @return The instantiated final GetMultiRequest
		 **/
		public GetMultiRequest build() {
			return new GetMultiRequest(
				this.accountGroupIds,
				this.projectionFilter,
				this.readFilter);
		}
	}

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy