com.amazonaws.services.comprehend.model.TargetedSentimentEntity Maven / Gradle / Ivy
Show all versions of aws-java-sdk-comprehend Show documentation
/*
* Copyright 2018-2023 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.comprehend.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
*
* Information about one of the entities found by targeted sentiment analysis.
*
*
* For more information about targeted sentiment, see Targeted sentiment in the
* Amazon Comprehend Developer Guide.
*
*
* @see AWS
* API Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class TargetedSentimentEntity implements Serializable, Cloneable, StructuredPojo {
/**
*
* One or more index into the Mentions array that provides the best name for the entity group.
*
*/
private java.util.List descriptiveMentionIndex;
/**
*
* An array of mentions of the entity in the document. The array represents a co-reference group. See
* Co-reference group for an example.
*
*/
private java.util.List mentions;
/**
*
* One or more index into the Mentions array that provides the best name for the entity group.
*
*
* @return One or more index into the Mentions array that provides the best name for the entity group.
*/
public java.util.List getDescriptiveMentionIndex() {
return descriptiveMentionIndex;
}
/**
*
* One or more index into the Mentions array that provides the best name for the entity group.
*
*
* @param descriptiveMentionIndex
* One or more index into the Mentions array that provides the best name for the entity group.
*/
public void setDescriptiveMentionIndex(java.util.Collection descriptiveMentionIndex) {
if (descriptiveMentionIndex == null) {
this.descriptiveMentionIndex = null;
return;
}
this.descriptiveMentionIndex = new java.util.ArrayList(descriptiveMentionIndex);
}
/**
*
* One or more index into the Mentions array that provides the best name for the entity group.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setDescriptiveMentionIndex(java.util.Collection)} or
* {@link #withDescriptiveMentionIndex(java.util.Collection)} if you want to override the existing values.
*
*
* @param descriptiveMentionIndex
* One or more index into the Mentions array that provides the best name for the entity group.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public TargetedSentimentEntity withDescriptiveMentionIndex(Integer... descriptiveMentionIndex) {
if (this.descriptiveMentionIndex == null) {
setDescriptiveMentionIndex(new java.util.ArrayList(descriptiveMentionIndex.length));
}
for (Integer ele : descriptiveMentionIndex) {
this.descriptiveMentionIndex.add(ele);
}
return this;
}
/**
*
* One or more index into the Mentions array that provides the best name for the entity group.
*
*
* @param descriptiveMentionIndex
* One or more index into the Mentions array that provides the best name for the entity group.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public TargetedSentimentEntity withDescriptiveMentionIndex(java.util.Collection descriptiveMentionIndex) {
setDescriptiveMentionIndex(descriptiveMentionIndex);
return this;
}
/**
*
* An array of mentions of the entity in the document. The array represents a co-reference group. See
* Co-reference group for an example.
*
*
* @return An array of mentions of the entity in the document. The array represents a co-reference group. See Co-reference group for an example.
*/
public java.util.List getMentions() {
return mentions;
}
/**
*
* An array of mentions of the entity in the document. The array represents a co-reference group. See
* Co-reference group for an example.
*
*
* @param mentions
* An array of mentions of the entity in the document. The array represents a co-reference group. See Co-reference group for an example.
*/
public void setMentions(java.util.Collection mentions) {
if (mentions == null) {
this.mentions = null;
return;
}
this.mentions = new java.util.ArrayList(mentions);
}
/**
*
* An array of mentions of the entity in the document. The array represents a co-reference group. See
* Co-reference group for an example.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setMentions(java.util.Collection)} or {@link #withMentions(java.util.Collection)} if you want to override
* the existing values.
*
*
* @param mentions
* An array of mentions of the entity in the document. The array represents a co-reference group. See Co-reference group for an example.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public TargetedSentimentEntity withMentions(TargetedSentimentMention... mentions) {
if (this.mentions == null) {
setMentions(new java.util.ArrayList(mentions.length));
}
for (TargetedSentimentMention ele : mentions) {
this.mentions.add(ele);
}
return this;
}
/**
*
* An array of mentions of the entity in the document. The array represents a co-reference group. See
* Co-reference group for an example.
*
*
* @param mentions
* An array of mentions of the entity in the document. The array represents a co-reference group. See Co-reference group for an example.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public TargetedSentimentEntity withMentions(java.util.Collection mentions) {
setMentions(mentions);
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 (getDescriptiveMentionIndex() != null)
sb.append("DescriptiveMentionIndex: ").append(getDescriptiveMentionIndex()).append(",");
if (getMentions() != null)
sb.append("Mentions: ").append(getMentions());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof TargetedSentimentEntity == false)
return false;
TargetedSentimentEntity other = (TargetedSentimentEntity) obj;
if (other.getDescriptiveMentionIndex() == null ^ this.getDescriptiveMentionIndex() == null)
return false;
if (other.getDescriptiveMentionIndex() != null && other.getDescriptiveMentionIndex().equals(this.getDescriptiveMentionIndex()) == false)
return false;
if (other.getMentions() == null ^ this.getMentions() == null)
return false;
if (other.getMentions() != null && other.getMentions().equals(this.getMentions()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getDescriptiveMentionIndex() == null) ? 0 : getDescriptiveMentionIndex().hashCode());
hashCode = prime * hashCode + ((getMentions() == null) ? 0 : getMentions().hashCode());
return hashCode;
}
@Override
public TargetedSentimentEntity clone() {
try {
return (TargetedSentimentEntity) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
@com.amazonaws.annotation.SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
com.amazonaws.services.comprehend.model.transform.TargetedSentimentEntityMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}