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

com.vendasta.accountgroup.v1.internal.ListPotentialDuplicatesResponse 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;

/**
 * ListPotentialDuplicatesResponse is the list of account groups that are likely to be a duplicate of the provided
 *  account group or location data.
 **/
public final class ListPotentialDuplicatesResponse {



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

	private final List potentialDuplicates;
	private final String nextCursor;
	private final boolean hasMore;
	private final long totalResults;
	

	private ListPotentialDuplicatesResponse (
		final List potentialDuplicates,
		final String nextCursor,
		final boolean hasMore,
		final long totalResults)
		
	{
		this.potentialDuplicates = potentialDuplicates;
		this.nextCursor = nextCursor;
		this.hasMore = hasMore;
		this.totalResults = totalResults;
		
	}
	
	/**
	 * 
      * @return The final value of potentialDuplicates on the object
	 **/
	public List getPotentialDuplicates() {
		return this.potentialDuplicates;
	}
	
	/**
	 * 
      * @return The final value of nextCursor on the object
	 **/
	public String getNextCursor() {
		return this.nextCursor;
	}
	
	/**
	 * 
      * @return The final value of hasMore on the object
	 **/
	public boolean getHasMore() {
		return this.hasMore;
	}
	
	/**
	 * 
      * @return The final value of totalResults on the object
	 **/
	public long getTotalResults() {
		return this.totalResults;
	}
	

	public static class Builder {
		private List potentialDuplicates;
		private String nextCursor;
		private boolean hasMore;
		private long totalResults;
		
		public Builder() {
			this.potentialDuplicates = null;
			this.nextCursor = "";
			this.hasMore = false;
			this.totalResults = 0;
			
		}
		
		/**
		  * Adds a value to the builder for potentialDuplicates
		  * @param potentialDuplicates Value to assign to the mutable Builder
		  * @return The Builder instance so that call chaining works
		 **/
		public Builder setPotentialDuplicates(List potentialDuplicates) {
			this.potentialDuplicates = potentialDuplicates;
			return this;
		}
		
		/**
		  * Adds a value to the builder for nextCursor
		  * @param nextCursor Value to assign to the mutable Builder
		  * @return The Builder instance so that call chaining works
		 **/
		public Builder setNextCursor(String nextCursor) {
			this.nextCursor = nextCursor;
			return this;
		}
		
		/**
		  * Adds a value to the builder for hasMore
		  * @param hasMore Value to assign to the mutable Builder
		  * @return The Builder instance so that call chaining works
		 **/
		public Builder setHasMore(boolean hasMore) {
			this.hasMore = hasMore;
			return this;
		}
		
		/**
		  * Adds a value to the builder for totalResults
		  * @param totalResults Value to assign to the mutable Builder
		  * @return The Builder instance so that call chaining works
		 **/
		public Builder setTotalResults(long totalResults) {
			this.totalResults = totalResults;
			return this;
		}
		
		/**
		  * Takes the configuration in the mutable Builder and uses it to instantiate a final instance
		  * of the ListPotentialDuplicatesResponse class
		  * @return The instantiated final ListPotentialDuplicatesResponse
		 **/
		public ListPotentialDuplicatesResponse build() {
			return new ListPotentialDuplicatesResponse(
				this.potentialDuplicates,
				this.nextCursor,
				this.hasMore,
				this.totalResults);
		}
	}

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy