com.amazonaws.services.cloudsearchdomain.model.Hit Maven / Gradle / Ivy
Show all versions of aws-java-sdk-cloudsearch Show documentation
/*
* Copyright 2011-2016 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.cloudsearchdomain.model;
import java.io.Serializable;
/**
*
* Information about a document that matches the search request.
*
*/
public class Hit implements Serializable, Cloneable {
/**
*
* The document ID of a document that matches the search request.
*
*/
private String id;
/**
*
* The fields returned from a document that matches the search request.
*
*/
private com.amazonaws.internal.SdkInternalMap> fields;
/**
*
* The expressions returned from a document that matches the search request.
*
*/
private com.amazonaws.internal.SdkInternalMap exprs;
/**
*
* The highlights returned from a document that matches the search request.
*
*/
private com.amazonaws.internal.SdkInternalMap highlights;
/**
*
* The document ID of a document that matches the search request.
*
*
* @param id
* The document ID of a document that matches the search request.
*/
public void setId(String id) {
this.id = id;
}
/**
*
* The document ID of a document that matches the search request.
*
*
* @return The document ID of a document that matches the search request.
*/
public String getId() {
return this.id;
}
/**
*
* The document ID of a document that matches the search request.
*
*
* @param id
* The document ID of a document that matches the search request.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public Hit withId(String id) {
setId(id);
return this;
}
/**
*
* The fields returned from a document that matches the search request.
*
*
* @return The fields returned from a document that matches the search
* request.
*/
public java.util.Map> getFields() {
if (fields == null) {
fields = new com.amazonaws.internal.SdkInternalMap>();
}
return fields;
}
/**
*
* The fields returned from a document that matches the search request.
*
*
* @param fields
* The fields returned from a document that matches the search
* request.
*/
public void setFields(java.util.Map> fields) {
this.fields = fields == null ? null
: new com.amazonaws.internal.SdkInternalMap>(
fields);
}
/**
*
* The fields returned from a document that matches the search request.
*
*
* @param fields
* The fields returned from a document that matches the search
* request.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public Hit withFields(java.util.Map> fields) {
setFields(fields);
return this;
}
public Hit addFieldsEntry(String key, java.util.List value) {
if (null == this.fields) {
this.fields = new com.amazonaws.internal.SdkInternalMap>();
}
if (this.fields.containsKey(key))
throw new IllegalArgumentException("Duplicated keys ("
+ key.toString() + ") are provided.");
this.fields.put(key, value);
return this;
}
/**
* Removes all the entries added into Fields. <p> Returns a reference to
* this object so that method calls can be chained together.
*/
public Hit clearFieldsEntries() {
this.fields = null;
return this;
}
/**
*
* The expressions returned from a document that matches the search request.
*
*
* @return The expressions returned from a document that matches the search
* request.
*/
public java.util.Map getExprs() {
if (exprs == null) {
exprs = new com.amazonaws.internal.SdkInternalMap();
}
return exprs;
}
/**
*
* The expressions returned from a document that matches the search request.
*
*
* @param exprs
* The expressions returned from a document that matches the search
* request.
*/
public void setExprs(java.util.Map exprs) {
this.exprs = exprs == null ? null
: new com.amazonaws.internal.SdkInternalMap(
exprs);
}
/**
*
* The expressions returned from a document that matches the search request.
*
*
* @param exprs
* The expressions returned from a document that matches the search
* request.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public Hit withExprs(java.util.Map exprs) {
setExprs(exprs);
return this;
}
public Hit addExprsEntry(String key, String value) {
if (null == this.exprs) {
this.exprs = new com.amazonaws.internal.SdkInternalMap();
}
if (this.exprs.containsKey(key))
throw new IllegalArgumentException("Duplicated keys ("
+ key.toString() + ") are provided.");
this.exprs.put(key, value);
return this;
}
/**
* Removes all the entries added into Exprs. <p> Returns a reference to
* this object so that method calls can be chained together.
*/
public Hit clearExprsEntries() {
this.exprs = null;
return this;
}
/**
*
* The highlights returned from a document that matches the search request.
*
*
* @return The highlights returned from a document that matches the search
* request.
*/
public java.util.Map getHighlights() {
if (highlights == null) {
highlights = new com.amazonaws.internal.SdkInternalMap();
}
return highlights;
}
/**
*
* The highlights returned from a document that matches the search request.
*
*
* @param highlights
* The highlights returned from a document that matches the search
* request.
*/
public void setHighlights(java.util.Map highlights) {
this.highlights = highlights == null ? null
: new com.amazonaws.internal.SdkInternalMap(
highlights);
}
/**
*
* The highlights returned from a document that matches the search request.
*
*
* @param highlights
* The highlights returned from a document that matches the search
* request.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public Hit withHighlights(java.util.Map highlights) {
setHighlights(highlights);
return this;
}
public Hit addHighlightsEntry(String key, String value) {
if (null == this.highlights) {
this.highlights = new com.amazonaws.internal.SdkInternalMap();
}
if (this.highlights.containsKey(key))
throw new IllegalArgumentException("Duplicated keys ("
+ key.toString() + ") are provided.");
this.highlights.put(key, value);
return this;
}
/**
* Removes all the entries added into Highlights. <p> Returns a reference
* to this object so that method calls can be chained together.
*/
public Hit clearHighlightsEntries() {
this.highlights = null;
return this;
}
/**
* Returns a string representation of this object; useful for testing and
* debugging.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getId() != null)
sb.append("Id: " + getId() + ",");
if (getFields() != null)
sb.append("Fields: " + getFields() + ",");
if (getExprs() != null)
sb.append("Exprs: " + getExprs() + ",");
if (getHighlights() != null)
sb.append("Highlights: " + getHighlights());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof Hit == false)
return false;
Hit other = (Hit) obj;
if (other.getId() == null ^ this.getId() == null)
return false;
if (other.getId() != null
&& other.getId().equals(this.getId()) == false)
return false;
if (other.getFields() == null ^ this.getFields() == null)
return false;
if (other.getFields() != null
&& other.getFields().equals(this.getFields()) == false)
return false;
if (other.getExprs() == null ^ this.getExprs() == null)
return false;
if (other.getExprs() != null
&& other.getExprs().equals(this.getExprs()) == false)
return false;
if (other.getHighlights() == null ^ this.getHighlights() == null)
return false;
if (other.getHighlights() != null
&& other.getHighlights().equals(this.getHighlights()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode
+ ((getId() == null) ? 0 : getId().hashCode());
hashCode = prime * hashCode
+ ((getFields() == null) ? 0 : getFields().hashCode());
hashCode = prime * hashCode
+ ((getExprs() == null) ? 0 : getExprs().hashCode());
hashCode = prime * hashCode
+ ((getHighlights() == null) ? 0 : getHighlights().hashCode());
return hashCode;
}
@Override
public Hit clone() {
try {
return (Hit) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException(
"Got a CloneNotSupportedException from Object.clone() "
+ "even though we're Cloneable!", e);
}
}
}