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

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



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

	private final List hoursOfOperation;
	

	private HoursOfOperation (
		final List hoursOfOperation)
		
	{
		this.hoursOfOperation = hoursOfOperation;
		
	}
	
	/**
	 * 
      * @return The final value of hoursOfOperation on the object
	 **/
	public List getHoursOfOperation() {
		return this.hoursOfOperation;
	}
	

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy