com.amazonaws.services.dynamodb.model.Condition Maven / Gradle / Ivy
Show all versions of aws-java-sdk Show documentation
/*
* Copyright 2010-2014 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.dynamodb.model;
import java.io.Serializable;
/**
* Condition
* @deprecated Use {@link com.amazonaws.services.dynamodbv2.model.Condition} instead.
*/
@Deprecated
public class Condition implements Serializable {
/**
* A list of attribute values to be used with a comparison operator for a
* scan or query operation. For comparisons that require more than one
* value, such as a BETWEEN
comparison, the
* AttributeValueList contains two attribute values and the comparison
* operator.
*/
private java.util.List attributeValueList;
/**
* A comparison operator is an enumeration of several operations:
* EQ
for equal. NE
for
* not equal. IN
checks for exact
* matches. LE
for less than or equal
* to. LT
for less than.
* GE
for greater than or equal to.
* GT
for greater than.
* BETWEEN
for between.
* NOT_NULL
for exists.
* NULL
for not exists.
* CONTAINS
for substring or value in a set.
* NOT_CONTAINS
for absence of a substring or absence of
* a value in a set. BEGINS_WITH
for a substring
* prefix.
Scan operations support all available comparison
* operators.
Query operations support a subset of the available
* comparison operators: EQ, LE, LT, GE, GT, BETWEEN, and BEGINS_WITH.
*
* Constraints:
* Allowed Values: EQ, NE, IN, LE, LT, GE, GT, BETWEEN, NOT_NULL, NULL, CONTAINS, NOT_CONTAINS, BEGINS_WITH
*/
private String comparisonOperator;
/**
* Default constructor for a new Condition object. Callers should use the
* setter or fluent setter (with...) methods to initialize this object after creating it.
*/
public Condition() {}
/**
* A list of attribute values to be used with a comparison operator for a
* scan or query operation. For comparisons that require more than one
* value, such as a BETWEEN
comparison, the
* AttributeValueList contains two attribute values and the comparison
* operator.
*
* @return A list of attribute values to be used with a comparison operator for a
* scan or query operation. For comparisons that require more than one
* value, such as a BETWEEN
comparison, the
* AttributeValueList contains two attribute values and the comparison
* operator.
*/
public java.util.List getAttributeValueList() {
return attributeValueList;
}
/**
* A list of attribute values to be used with a comparison operator for a
* scan or query operation. For comparisons that require more than one
* value, such as a BETWEEN
comparison, the
* AttributeValueList contains two attribute values and the comparison
* operator.
*
* @param attributeValueList A list of attribute values to be used with a comparison operator for a
* scan or query operation. For comparisons that require more than one
* value, such as a BETWEEN
comparison, the
* AttributeValueList contains two attribute values and the comparison
* operator.
*/
public void setAttributeValueList(java.util.Collection attributeValueList) {
if (attributeValueList == null) {
this.attributeValueList = null;
return;
}
java.util.List attributeValueListCopy = new java.util.ArrayList(attributeValueList.size());
attributeValueListCopy.addAll(attributeValueList);
this.attributeValueList = attributeValueListCopy;
}
/**
* A list of attribute values to be used with a comparison operator for a
* scan or query operation. For comparisons that require more than one
* value, such as a BETWEEN
comparison, the
* AttributeValueList contains two attribute values and the comparison
* operator.
*
* Returns a reference to this object so that method calls can be chained together.
*
* @param attributeValueList A list of attribute values to be used with a comparison operator for a
* scan or query operation. For comparisons that require more than one
* value, such as a BETWEEN
comparison, the
* AttributeValueList contains two attribute values and the comparison
* operator.
*
* @return A reference to this updated object so that method calls can be chained
* together.
*/
public Condition withAttributeValueList(AttributeValue... attributeValueList) {
if (getAttributeValueList() == null) setAttributeValueList(new java.util.ArrayList(attributeValueList.length));
for (AttributeValue value : attributeValueList) {
getAttributeValueList().add(value);
}
return this;
}
/**
* A list of attribute values to be used with a comparison operator for a
* scan or query operation. For comparisons that require more than one
* value, such as a BETWEEN
comparison, the
* AttributeValueList contains two attribute values and the comparison
* operator.
*
* Returns a reference to this object so that method calls can be chained together.
*
* @param attributeValueList A list of attribute values to be used with a comparison operator for a
* scan or query operation. For comparisons that require more than one
* value, such as a BETWEEN
comparison, the
* AttributeValueList contains two attribute values and the comparison
* operator.
*
* @return A reference to this updated object so that method calls can be chained
* together.
*/
public Condition withAttributeValueList(java.util.Collection attributeValueList) {
if (attributeValueList == null) {
this.attributeValueList = null;
} else {
java.util.List attributeValueListCopy = new java.util.ArrayList(attributeValueList.size());
attributeValueListCopy.addAll(attributeValueList);
this.attributeValueList = attributeValueListCopy;
}
return this;
}
/**
* A comparison operator is an enumeration of several operations:
* EQ
for equal. NE
for
* not equal. IN
checks for exact
* matches. LE
for less than or equal
* to. LT
for less than.
* GE
for greater than or equal to.
* GT
for greater than.
* BETWEEN
for between.
* NOT_NULL
for exists.
* NULL
for not exists.
* CONTAINS
for substring or value in a set.
* NOT_CONTAINS
for absence of a substring or absence of
* a value in a set. BEGINS_WITH
for a substring
* prefix.
Scan operations support all available comparison
* operators.
Query operations support a subset of the available
* comparison operators: EQ, LE, LT, GE, GT, BETWEEN, and BEGINS_WITH.
*
* Constraints:
* Allowed Values: EQ, NE, IN, LE, LT, GE, GT, BETWEEN, NOT_NULL, NULL, CONTAINS, NOT_CONTAINS, BEGINS_WITH
*
* @return A comparison operator is an enumeration of several operations:
* EQ
for equal. NE
for
* not equal. IN
checks for exact
* matches. LE
for less than or equal
* to. LT
for less than.
* GE
for greater than or equal to.
* GT
for greater than.
* BETWEEN
for between.
* NOT_NULL
for exists.
* NULL
for not exists.
* CONTAINS
for substring or value in a set.
* NOT_CONTAINS
for absence of a substring or absence of
* a value in a set. BEGINS_WITH
for a substring
* prefix.
Scan operations support all available comparison
* operators.
Query operations support a subset of the available
* comparison operators: EQ, LE, LT, GE, GT, BETWEEN, and BEGINS_WITH.
*
* @see ComparisonOperator
*/
public String getComparisonOperator() {
return comparisonOperator;
}
/**
* A comparison operator is an enumeration of several operations:
* EQ
for equal. NE
for
* not equal. IN
checks for exact
* matches. LE
for less than or equal
* to. LT
for less than.
* GE
for greater than or equal to.
* GT
for greater than.
* BETWEEN
for between.
* NOT_NULL
for exists.
* NULL
for not exists.
* CONTAINS
for substring or value in a set.
* NOT_CONTAINS
for absence of a substring or absence of
* a value in a set. BEGINS_WITH
for a substring
* prefix.
Scan operations support all available comparison
* operators.
Query operations support a subset of the available
* comparison operators: EQ, LE, LT, GE, GT, BETWEEN, and BEGINS_WITH.
*
* Constraints:
* Allowed Values: EQ, NE, IN, LE, LT, GE, GT, BETWEEN, NOT_NULL, NULL, CONTAINS, NOT_CONTAINS, BEGINS_WITH
*
* @param comparisonOperator A comparison operator is an enumeration of several operations:
* EQ
for equal. NE
for
* not equal. IN
checks for exact
* matches. LE
for less than or equal
* to. LT
for less than.
* GE
for greater than or equal to.
* GT
for greater than.
* BETWEEN
for between.
* NOT_NULL
for exists.
* NULL
for not exists.
* CONTAINS
for substring or value in a set.
* NOT_CONTAINS
for absence of a substring or absence of
* a value in a set. BEGINS_WITH
for a substring
* prefix.
Scan operations support all available comparison
* operators.
Query operations support a subset of the available
* comparison operators: EQ, LE, LT, GE, GT, BETWEEN, and BEGINS_WITH.
*
* @see ComparisonOperator
*/
public void setComparisonOperator(String comparisonOperator) {
this.comparisonOperator = comparisonOperator;
}
/**
* A comparison operator is an enumeration of several operations:
* EQ
for equal. NE
for
* not equal. IN
checks for exact
* matches. LE
for less than or equal
* to. LT
for less than.
* GE
for greater than or equal to.
* GT
for greater than.
* BETWEEN
for between.
* NOT_NULL
for exists.
* NULL
for not exists.
* CONTAINS
for substring or value in a set.
* NOT_CONTAINS
for absence of a substring or absence of
* a value in a set. BEGINS_WITH
for a substring
* prefix.
Scan operations support all available comparison
* operators.
Query operations support a subset of the available
* comparison operators: EQ, LE, LT, GE, GT, BETWEEN, and BEGINS_WITH.
*
* Returns a reference to this object so that method calls can be chained together.
*
* Constraints:
* Allowed Values: EQ, NE, IN, LE, LT, GE, GT, BETWEEN, NOT_NULL, NULL, CONTAINS, NOT_CONTAINS, BEGINS_WITH
*
* @param comparisonOperator A comparison operator is an enumeration of several operations:
* EQ
for equal. NE
for
* not equal. IN
checks for exact
* matches. LE
for less than or equal
* to. LT
for less than.
* GE
for greater than or equal to.
* GT
for greater than.
* BETWEEN
for between.
* NOT_NULL
for exists.
* NULL
for not exists.
* CONTAINS
for substring or value in a set.
* NOT_CONTAINS
for absence of a substring or absence of
* a value in a set. BEGINS_WITH
for a substring
* prefix.
Scan operations support all available comparison
* operators.
Query operations support a subset of the available
* comparison operators: EQ, LE, LT, GE, GT, BETWEEN, and BEGINS_WITH.
*
* @return A reference to this updated object so that method calls can be chained
* together.
*
* @see ComparisonOperator
*/
public Condition withComparisonOperator(String comparisonOperator) {
this.comparisonOperator = comparisonOperator;
return this;
}
/**
* A comparison operator is an enumeration of several operations:
* EQ
for equal. NE
for
* not equal. IN
checks for exact
* matches. LE
for less than or equal
* to. LT
for less than.
* GE
for greater than or equal to.
* GT
for greater than.
* BETWEEN
for between.
* NOT_NULL
for exists.
* NULL
for not exists.
* CONTAINS
for substring or value in a set.
* NOT_CONTAINS
for absence of a substring or absence of
* a value in a set. BEGINS_WITH
for a substring
* prefix.
Scan operations support all available comparison
* operators.
Query operations support a subset of the available
* comparison operators: EQ, LE, LT, GE, GT, BETWEEN, and BEGINS_WITH.
*
* Constraints:
* Allowed Values: EQ, NE, IN, LE, LT, GE, GT, BETWEEN, NOT_NULL, NULL, CONTAINS, NOT_CONTAINS, BEGINS_WITH
*
* @param comparisonOperator A comparison operator is an enumeration of several operations:
* EQ
for equal. NE
for
* not equal. IN
checks for exact
* matches. LE
for less than or equal
* to. LT
for less than.
* GE
for greater than or equal to.
* GT
for greater than.
* BETWEEN
for between.
* NOT_NULL
for exists.
* NULL
for not exists.
* CONTAINS
for substring or value in a set.
* NOT_CONTAINS
for absence of a substring or absence of
* a value in a set. BEGINS_WITH
for a substring
* prefix.
Scan operations support all available comparison
* operators.
Query operations support a subset of the available
* comparison operators: EQ, LE, LT, GE, GT, BETWEEN, and BEGINS_WITH.
*
* @see ComparisonOperator
*/
public void setComparisonOperator(ComparisonOperator comparisonOperator) {
this.comparisonOperator = comparisonOperator.toString();
}
/**
* A comparison operator is an enumeration of several operations:
* EQ
for equal. NE
for
* not equal. IN
checks for exact
* matches. LE
for less than or equal
* to. LT
for less than.
* GE
for greater than or equal to.
* GT
for greater than.
* BETWEEN
for between.
* NOT_NULL
for exists.
* NULL
for not exists.
* CONTAINS
for substring or value in a set.
* NOT_CONTAINS
for absence of a substring or absence of
* a value in a set. BEGINS_WITH
for a substring
* prefix.
Scan operations support all available comparison
* operators.
Query operations support a subset of the available
* comparison operators: EQ, LE, LT, GE, GT, BETWEEN, and BEGINS_WITH.
*
* Returns a reference to this object so that method calls can be chained together.
*
* Constraints:
* Allowed Values: EQ, NE, IN, LE, LT, GE, GT, BETWEEN, NOT_NULL, NULL, CONTAINS, NOT_CONTAINS, BEGINS_WITH
*
* @param comparisonOperator A comparison operator is an enumeration of several operations:
* EQ
for equal. NE
for
* not equal. IN
checks for exact
* matches. LE
for less than or equal
* to. LT
for less than.
* GE
for greater than or equal to.
* GT
for greater than.
* BETWEEN
for between.
* NOT_NULL
for exists.
* NULL
for not exists.
* CONTAINS
for substring or value in a set.
* NOT_CONTAINS
for absence of a substring or absence of
* a value in a set. BEGINS_WITH
for a substring
* prefix.
Scan operations support all available comparison
* operators.
Query operations support a subset of the available
* comparison operators: EQ, LE, LT, GE, GT, BETWEEN, and BEGINS_WITH.
*
* @return A reference to this updated object so that method calls can be chained
* together.
*
* @see ComparisonOperator
*/
public Condition withComparisonOperator(ComparisonOperator comparisonOperator) {
this.comparisonOperator = comparisonOperator.toString();
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 (getAttributeValueList() != null) sb.append("AttributeValueList: " + getAttributeValueList() + ", ");
if (getComparisonOperator() != null) sb.append("ComparisonOperator: " + getComparisonOperator() + ", ");
sb.append("}");
return sb.toString();
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getAttributeValueList() == null) ? 0 : getAttributeValueList().hashCode());
hashCode = prime * hashCode + ((getComparisonOperator() == null) ? 0 : getComparisonOperator().hashCode());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null) return false;
if (obj instanceof Condition == false) return false;
Condition other = (Condition)obj;
if (other.getAttributeValueList() == null ^ this.getAttributeValueList() == null) return false;
if (other.getAttributeValueList() != null && other.getAttributeValueList().equals(this.getAttributeValueList()) == false) return false;
if (other.getComparisonOperator() == null ^ this.getComparisonOperator() == null) return false;
if (other.getComparisonOperator() != null && other.getComparisonOperator().equals(this.getComparisonOperator()) == false) return false;
return true;
}
}