com.amazonaws.services.kendra.model.QueryResult Maven / Gradle / Ivy
Show all versions of aws-java-sdk-kendra Show documentation
/*
* Copyright 2015-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.kendra.model;
import java.io.Serializable;
import javax.annotation.Generated;
/**
*
* @see AWS API Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class QueryResult extends com.amazonaws.AmazonWebServiceResult implements Serializable, Cloneable {
/**
*
* The unique identifier for the search. You use QueryId
to identify the search when using the feedback
* API.
*
*/
private String queryId;
/**
*
* The results of the search.
*
*/
private java.util.List resultItems;
/**
*
* Contains the facet results. A FacetResult
contains the counts for each attribute key that was
* specified in the Facets
input parameter.
*
*/
private java.util.List facetResults;
/**
*
* The number of items returned by the search. Use this to determine when you have requested the last set of
* results.
*
*/
private Integer totalNumberOfResults;
/**
*
* The unique identifier for the search. You use QueryId
to identify the search when using the feedback
* API.
*
*
* @param queryId
* The unique identifier for the search. You use QueryId
to identify the search when using the
* feedback API.
*/
public void setQueryId(String queryId) {
this.queryId = queryId;
}
/**
*
* The unique identifier for the search. You use QueryId
to identify the search when using the feedback
* API.
*
*
* @return The unique identifier for the search. You use QueryId
to identify the search when using the
* feedback API.
*/
public String getQueryId() {
return this.queryId;
}
/**
*
* The unique identifier for the search. You use QueryId
to identify the search when using the feedback
* API.
*
*
* @param queryId
* The unique identifier for the search. You use QueryId
to identify the search when using the
* feedback API.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public QueryResult withQueryId(String queryId) {
setQueryId(queryId);
return this;
}
/**
*
* The results of the search.
*
*
* @return The results of the search.
*/
public java.util.List getResultItems() {
return resultItems;
}
/**
*
* The results of the search.
*
*
* @param resultItems
* The results of the search.
*/
public void setResultItems(java.util.Collection resultItems) {
if (resultItems == null) {
this.resultItems = null;
return;
}
this.resultItems = new java.util.ArrayList(resultItems);
}
/**
*
* The results of the search.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setResultItems(java.util.Collection)} or {@link #withResultItems(java.util.Collection)} if you want to
* override the existing values.
*
*
* @param resultItems
* The results of the search.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public QueryResult withResultItems(QueryResultItem... resultItems) {
if (this.resultItems == null) {
setResultItems(new java.util.ArrayList(resultItems.length));
}
for (QueryResultItem ele : resultItems) {
this.resultItems.add(ele);
}
return this;
}
/**
*
* The results of the search.
*
*
* @param resultItems
* The results of the search.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public QueryResult withResultItems(java.util.Collection resultItems) {
setResultItems(resultItems);
return this;
}
/**
*
* Contains the facet results. A FacetResult
contains the counts for each attribute key that was
* specified in the Facets
input parameter.
*
*
* @return Contains the facet results. A FacetResult
contains the counts for each attribute key that
* was specified in the Facets
input parameter.
*/
public java.util.List getFacetResults() {
return facetResults;
}
/**
*
* Contains the facet results. A FacetResult
contains the counts for each attribute key that was
* specified in the Facets
input parameter.
*
*
* @param facetResults
* Contains the facet results. A FacetResult
contains the counts for each attribute key that was
* specified in the Facets
input parameter.
*/
public void setFacetResults(java.util.Collection facetResults) {
if (facetResults == null) {
this.facetResults = null;
return;
}
this.facetResults = new java.util.ArrayList(facetResults);
}
/**
*
* Contains the facet results. A FacetResult
contains the counts for each attribute key that was
* specified in the Facets
input parameter.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setFacetResults(java.util.Collection)} or {@link #withFacetResults(java.util.Collection)} if you want to
* override the existing values.
*
*
* @param facetResults
* Contains the facet results. A FacetResult
contains the counts for each attribute key that was
* specified in the Facets
input parameter.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public QueryResult withFacetResults(FacetResult... facetResults) {
if (this.facetResults == null) {
setFacetResults(new java.util.ArrayList(facetResults.length));
}
for (FacetResult ele : facetResults) {
this.facetResults.add(ele);
}
return this;
}
/**
*
* Contains the facet results. A FacetResult
contains the counts for each attribute key that was
* specified in the Facets
input parameter.
*
*
* @param facetResults
* Contains the facet results. A FacetResult
contains the counts for each attribute key that was
* specified in the Facets
input parameter.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public QueryResult withFacetResults(java.util.Collection facetResults) {
setFacetResults(facetResults);
return this;
}
/**
*
* The number of items returned by the search. Use this to determine when you have requested the last set of
* results.
*
*
* @param totalNumberOfResults
* The number of items returned by the search. Use this to determine when you have requested the last set of
* results.
*/
public void setTotalNumberOfResults(Integer totalNumberOfResults) {
this.totalNumberOfResults = totalNumberOfResults;
}
/**
*
* The number of items returned by the search. Use this to determine when you have requested the last set of
* results.
*
*
* @return The number of items returned by the search. Use this to determine when you have requested the last set of
* results.
*/
public Integer getTotalNumberOfResults() {
return this.totalNumberOfResults;
}
/**
*
* The number of items returned by the search. Use this to determine when you have requested the last set of
* results.
*
*
* @param totalNumberOfResults
* The number of items returned by the search. Use this to determine when you have requested the last set of
* results.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public QueryResult withTotalNumberOfResults(Integer totalNumberOfResults) {
setTotalNumberOfResults(totalNumberOfResults);
return this;
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getQueryId() != null)
sb.append("QueryId: ").append(getQueryId()).append(",");
if (getResultItems() != null)
sb.append("ResultItems: ").append(getResultItems()).append(",");
if (getFacetResults() != null)
sb.append("FacetResults: ").append(getFacetResults()).append(",");
if (getTotalNumberOfResults() != null)
sb.append("TotalNumberOfResults: ").append(getTotalNumberOfResults());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof QueryResult == false)
return false;
QueryResult other = (QueryResult) obj;
if (other.getQueryId() == null ^ this.getQueryId() == null)
return false;
if (other.getQueryId() != null && other.getQueryId().equals(this.getQueryId()) == false)
return false;
if (other.getResultItems() == null ^ this.getResultItems() == null)
return false;
if (other.getResultItems() != null && other.getResultItems().equals(this.getResultItems()) == false)
return false;
if (other.getFacetResults() == null ^ this.getFacetResults() == null)
return false;
if (other.getFacetResults() != null && other.getFacetResults().equals(this.getFacetResults()) == false)
return false;
if (other.getTotalNumberOfResults() == null ^ this.getTotalNumberOfResults() == null)
return false;
if (other.getTotalNumberOfResults() != null && other.getTotalNumberOfResults().equals(this.getTotalNumberOfResults()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getQueryId() == null) ? 0 : getQueryId().hashCode());
hashCode = prime * hashCode + ((getResultItems() == null) ? 0 : getResultItems().hashCode());
hashCode = prime * hashCode + ((getFacetResults() == null) ? 0 : getFacetResults().hashCode());
hashCode = prime * hashCode + ((getTotalNumberOfResults() == null) ? 0 : getTotalNumberOfResults().hashCode());
return hashCode;
}
@Override
public QueryResult clone() {
try {
return (QueryResult) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
}