org.apache.cassandra.thrift.SlicePredicate Maven / Gradle / Ivy
/**
* Autogenerated by Thrift Compiler (1.0.0-dev)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package org.apache.cassandra.thrift;
import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;
import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import javax.annotation.Generated;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
/**
* A SlicePredicate is similar to a mathematic predicate (see http://en.wikipedia.org/wiki/Predicate_(mathematical_logic)),
* which is described as "a property that the elements of a set have in common."
*
* SlicePredicate's in Cassandra are described with either a list of column_names or a SliceRange. If column_names is
* specified, slice_range is ignored.
*
* @param column_name. A list of column names to retrieve. This can be used similar to Memcached's "multi-get" feature
* to fetch N known column names. For instance, if you know you wish to fetch columns 'Joe', 'Jack',
* and 'Jim' you can pass those column names as a list to fetch all three at once.
* @param slice_range. A SliceRange describing how to range, order, and/or limit the slice.
*/
@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2016-02-10")
public class SlicePredicate implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("SlicePredicate");
private static final org.apache.thrift.protocol.TField COLUMN_NAMES_FIELD_DESC = new org.apache.thrift.protocol.TField("column_names", org.apache.thrift.protocol.TType.LIST, (short)1);
private static final org.apache.thrift.protocol.TField SLICE_RANGE_FIELD_DESC = new org.apache.thrift.protocol.TField("slice_range", org.apache.thrift.protocol.TType.STRUCT, (short)2);
private static final SchemeFactory STANDARD_SCHEME_FACTORY = new SlicePredicateStandardSchemeFactory();
private static final SchemeFactory TUPLE_SCHEME_FACTORY = new SlicePredicateTupleSchemeFactory();
public List column_names; // optional
public SliceRange slice_range; // optional
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
COLUMN_NAMES((short)1, "column_names"),
SLICE_RANGE((short)2, "slice_range");
private static final Map byName = new HashMap();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 1: // COLUMN_NAMES
return COLUMN_NAMES;
case 2: // SLICE_RANGE
return SLICE_RANGE;
default:
return null;
}
}
/**
* Find the _Fields constant that matches fieldId, throwing an exception
* if it is not found.
*/
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields = findByThriftId(fieldId);
if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
public static _Fields findByName(String name) {
return byName.get(name);
}
private final short _thriftId;
private final String _fieldName;
_Fields(short thriftId, String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public String getFieldName() {
return _fieldName;
}
}
// isset id assignments
private static final _Fields optionals[] = {_Fields.COLUMN_NAMES,_Fields.SLICE_RANGE};
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.COLUMN_NAMES, new org.apache.thrift.meta_data.FieldMetaData("column_names", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true))));
tmpMap.put(_Fields.SLICE_RANGE, new org.apache.thrift.meta_data.FieldMetaData("slice_range", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, SliceRange.class)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(SlicePredicate.class, metaDataMap);
}
public SlicePredicate() {
}
/**
* Performs a deep copy on other.
*/
public SlicePredicate(SlicePredicate other) {
if (other.isSetColumn_names()) {
List __this__column_names = new ArrayList(other.column_names);
this.column_names = __this__column_names;
}
if (other.isSetSlice_range()) {
this.slice_range = new SliceRange(other.slice_range);
}
}
public SlicePredicate deepCopy() {
return new SlicePredicate(this);
}
@Override
public void clear() {
this.column_names = null;
this.slice_range = null;
}
public int getColumn_namesSize() {
return (this.column_names == null) ? 0 : this.column_names.size();
}
public java.util.Iterator getColumn_namesIterator() {
return (this.column_names == null) ? null : this.column_names.iterator();
}
public void addToColumn_names(ByteBuffer elem) {
if (this.column_names == null) {
this.column_names = new ArrayList();
}
this.column_names.add(elem);
}
public List getColumn_names() {
return this.column_names;
}
public SlicePredicate setColumn_names(List column_names) {
this.column_names = column_names;
return this;
}
public void unsetColumn_names() {
this.column_names = null;
}
/** Returns true if field column_names is set (has been assigned a value) and false otherwise */
public boolean isSetColumn_names() {
return this.column_names != null;
}
public void setColumn_namesIsSet(boolean value) {
if (!value) {
this.column_names = null;
}
}
public SliceRange getSlice_range() {
return this.slice_range;
}
public SlicePredicate setSlice_range(SliceRange slice_range) {
this.slice_range = slice_range;
return this;
}
public void unsetSlice_range() {
this.slice_range = null;
}
/** Returns true if field slice_range is set (has been assigned a value) and false otherwise */
public boolean isSetSlice_range() {
return this.slice_range != null;
}
public void setSlice_rangeIsSet(boolean value) {
if (!value) {
this.slice_range = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case COLUMN_NAMES:
if (value == null) {
unsetColumn_names();
} else {
setColumn_names((List)value);
}
break;
case SLICE_RANGE:
if (value == null) {
unsetSlice_range();
} else {
setSlice_range((SliceRange)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case COLUMN_NAMES:
return getColumn_names();
case SLICE_RANGE:
return getSlice_range();
}
throw new IllegalStateException();
}
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case COLUMN_NAMES:
return isSetColumn_names();
case SLICE_RANGE:
return isSetSlice_range();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof SlicePredicate)
return this.equals((SlicePredicate)that);
return false;
}
public boolean equals(SlicePredicate that) {
if (that == null)
return false;
boolean this_present_column_names = true && this.isSetColumn_names();
boolean that_present_column_names = true && that.isSetColumn_names();
if (this_present_column_names || that_present_column_names) {
if (!(this_present_column_names && that_present_column_names))
return false;
if (!this.column_names.equals(that.column_names))
return false;
}
boolean this_present_slice_range = true && this.isSetSlice_range();
boolean that_present_slice_range = true && that.isSetSlice_range();
if (this_present_slice_range || that_present_slice_range) {
if (!(this_present_slice_range && that_present_slice_range))
return false;
if (!this.slice_range.equals(that.slice_range))
return false;
}
return true;
}
@Override
public int hashCode() {
List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy