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

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

	/**
	 * 
	 **/
	public enum Actions { 
		APPEND(0),
			REMOVE(1);
		
		private static final Map protoTypeMap;
		static {
			Map aMap;
			aMap = new HashMap();
			aMap.put(ApiProto.ActionListModify.Actions.APPEND, ActionListModify.Actions.APPEND);
			aMap.put(ApiProto.ActionListModify.Actions.REMOVE, ActionListModify.Actions.REMOVE);
			protoTypeMap = Collections.unmodifiableMap(aMap);
		}
	
		private static final Map javaTypeMap;
		static {
			Map aMap;
			aMap = new HashMap();
			aMap.put(ActionListModify.Actions.APPEND, ApiProto.ActionListModify.Actions.APPEND);
			aMap.put(ActionListModify.Actions.REMOVE, ApiProto.ActionListModify.Actions.REMOVE);
			javaTypeMap = Collections.unmodifiableMap(aMap);
		}
	
		private int value;
	
		private Actions(int i) {
			value = i;
		}
		public int getValue() {
			return value;
		}
	
		public static Actions fromProto(ApiProto.ActionListModify.Actions proto) {
			return protoTypeMap.get(proto);
		}
	
		public static List fromProtos(List protos) {
			List result = new ArrayList();
			for(ApiProto.ActionListModify.Actions proto : protos) {
				result.add(Actions.fromProto(proto));
			}
			return result;
		}
	
		public ApiProto.ActionListModify.Actions toProto() {
			return javaTypeMap.get(this);
		}
	
		public static List toProtos(List objects) {
			List result = new ArrayList();
			for(Actions obj : objects) {
				result.add(obj.toProto());
			}
			return result;
		}
	}



	private final String actionListName;
	private final ActionListModify.Actions action;
	

	private ActionListModify (
		final String actionListName,
		final ActionListModify.Actions action)
		
	{
		this.actionListName = actionListName;
		this.action = action;
		
	}
	
	/**
	 * 
      * @return The final value of actionListName on the object
	 **/
	public String getActionListName() {
		return this.actionListName;
	}
	
	/**
	 * 
      * @return The final value of action on the object
	 **/
	public ActionListModify.Actions getAction() {
		return this.action;
	}
	

	public static class Builder {
		private String actionListName;
		private ActionListModify.Actions action;
		
		public Builder() {
			this.actionListName = "";
			this.action = null;
			
		}
		
		/**
		  * Adds a value to the builder for actionListName
		  * @param actionListName Value to assign to the mutable Builder
		  * @return The Builder instance so that call chaining works
		 **/
		public Builder setActionListName(String actionListName) {
			this.actionListName = actionListName;
			return this;
		}
		
		/**
		  * Adds a value to the builder for action
		  * @param action Value to assign to the mutable Builder
		  * @return The Builder instance so that call chaining works
		 **/
		public Builder setAction(ActionListModify.Actions action) {
			this.action = action;
			return this;
		}
		
		/**
		  * Takes the configuration in the mutable Builder and uses it to instantiate a final instance
		  * of the ActionListModify class
		  * @return The instantiated final ActionListModify
		 **/
		public ActionListModify build() {
			return new ActionListModify(
				this.actionListName,
				this.action);
		}
	}

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy