Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,398 @@
/**
* Autogenerated by Thrift
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
*/
package com.inmobi.audit.thrift;

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 org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.apache.thrift.*;
import org.apache.thrift.async.*;
import org.apache.thrift.meta_data.*;
import org.apache.thrift.transport.*;
import org.apache.thrift.protocol.*;

public class AuditMetrics implements TBase<AuditMetrics, AuditMetrics._Fields>, java.io.Serializable, Cloneable {
private static final TStruct STRUCT_DESC = new TStruct("AuditMetrics");

private static final TField COUNT_FIELD_DESC = new TField("count", TType.I64, (short)1);
private static final TField SIZE_FIELD_DESC = new TField("size", TType.I64, (short)2);

public long count;
public long size;

/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements TFieldIdEnum {
COUNT((short)1, "count"),
SIZE((short)2, "size");

private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();

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: // COUNT
return COUNT;
case 2: // SIZE
return SIZE;
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 int __COUNT_ISSET_ID = 0;
private static final int __SIZE_ISSET_ID = 1;
private BitSet __isset_bit_vector = new BitSet(2);

public static final Map<_Fields, FieldMetaData> metaDataMap;
static {
Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.COUNT, new FieldMetaData("count", TFieldRequirementType.DEFAULT,
new FieldValueMetaData(TType.I64)));
tmpMap.put(_Fields.SIZE, new FieldMetaData("size", TFieldRequirementType.DEFAULT,
new FieldValueMetaData(TType.I64)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
FieldMetaData.addStructMetaDataMap(AuditMetrics.class, metaDataMap);
}

public AuditMetrics() {
}

public AuditMetrics(
long count,
long size)
{
this();
this.count = count;
setCountIsSet(true);
this.size = size;
setSizeIsSet(true);
}

/**
* Performs a deep copy on <i>other</i>.
*/
public AuditMetrics(AuditMetrics other) {
__isset_bit_vector.clear();
__isset_bit_vector.or(other.__isset_bit_vector);
this.count = other.count;
this.size = other.size;
}

public AuditMetrics deepCopy() {
return new AuditMetrics(this);
}

@Deprecated
public AuditMetrics clone() {
return new AuditMetrics(this);
}

@Override
public void clear() {
setCountIsSet(false);
this.count = 0;
setSizeIsSet(false);
this.size = 0;
}

public long getCount() {
return this.count;
}

public AuditMetrics setCount(long count) {
this.count = count;
setCountIsSet(true);
return this;
}

public void unsetCount() {
__isset_bit_vector.clear(__COUNT_ISSET_ID);
}

/** Returns true if field count is set (has been asigned a value) and false otherwise */
public boolean isSetCount() {
return __isset_bit_vector.get(__COUNT_ISSET_ID);
}

public void setCountIsSet(boolean value) {
__isset_bit_vector.set(__COUNT_ISSET_ID, value);
}

public long getSize() {
return this.size;
}

public AuditMetrics setSize(long size) {
this.size = size;
setSizeIsSet(true);
return this;
}

public void unsetSize() {
__isset_bit_vector.clear(__SIZE_ISSET_ID);
}

/** Returns true if field size is set (has been asigned a value) and false otherwise */
public boolean isSetSize() {
return __isset_bit_vector.get(__SIZE_ISSET_ID);
}

public void setSizeIsSet(boolean value) {
__isset_bit_vector.set(__SIZE_ISSET_ID, value);
}

public void setFieldValue(_Fields field, Object value) {
switch (field) {
case COUNT:
if (value == null) {
unsetCount();
} else {
setCount((Long)value);
}
break;

case SIZE:
if (value == null) {
unsetSize();
} else {
setSize((Long)value);
}
break;

}
}

public void setFieldValue(int fieldID, Object value) {
setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
}

public Object getFieldValue(_Fields field) {
switch (field) {
case COUNT:
return new Long(getCount());

case SIZE:
return new Long(getSize());

}
throw new IllegalStateException();
}

public Object getFieldValue(int fieldId) {
return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
}

/** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
public boolean isSet(_Fields field) {
switch (field) {
case COUNT:
return isSetCount();
case SIZE:
return isSetSize();
}
throw new IllegalStateException();
}

public boolean isSet(int fieldID) {
return isSet(_Fields.findByThriftIdOrThrow(fieldID));
}

@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof AuditMetrics)
return this.equals((AuditMetrics)that);
return false;
}

public boolean equals(AuditMetrics that) {
if (that == null)
return false;

boolean this_present_count = true;
boolean that_present_count = true;
if (this_present_count || that_present_count) {
if (!(this_present_count && that_present_count))
return false;
if (this.count != that.count)
return false;
}

boolean this_present_size = true;
boolean that_present_size = true;
if (this_present_size || that_present_size) {
if (!(this_present_size && that_present_size))
return false;
if (this.size != that.size)
return false;
}

return true;
}

@Override
public int hashCode() {
return 0;
}

public int compareTo(AuditMetrics other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}

int lastComparison = 0;
AuditMetrics typedOther = (AuditMetrics)other;

lastComparison = Boolean.valueOf(isSetCount()).compareTo(typedOther.isSetCount());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetCount()) { lastComparison = TBaseHelper.compareTo(this.count, typedOther.count);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetSize()).compareTo(typedOther.isSetSize());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetSize()) { lastComparison = TBaseHelper.compareTo(this.size, typedOther.size);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0;
}

public void read(TProtocol iprot) throws TException {
TField field;
iprot.readStructBegin();
while (true)
{
field = iprot.readFieldBegin();
if (field.type == TType.STOP) {
break;
}
switch (field.id) {
case 1: // COUNT
if (field.type == TType.I64) {
this.count = iprot.readI64();
setCountIsSet(true);
} else {
TProtocolUtil.skip(iprot, field.type);
}
break;
case 2: // SIZE
if (field.type == TType.I64) {
this.size = iprot.readI64();
setSizeIsSet(true);
} else {
TProtocolUtil.skip(iprot, field.type);
}
break;
default:
TProtocolUtil.skip(iprot, field.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();

// check for required fields of primitive type, which can't be checked in the validate method
validate();
}

public void write(TProtocol oprot) throws TException {
validate();

oprot.writeStructBegin(STRUCT_DESC);
oprot.writeFieldBegin(COUNT_FIELD_DESC);
oprot.writeI64(this.count);
oprot.writeFieldEnd();
oprot.writeFieldBegin(SIZE_FIELD_DESC);
oprot.writeI64(this.size);
oprot.writeFieldEnd();
oprot.writeFieldStop();
oprot.writeStructEnd();
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder("AuditMetrics(");
boolean first = true;

sb.append("count:");
sb.append(this.count);
first = false;
if (!first) sb.append(", ");
sb.append("size:");
sb.append(this.size);
first = false;
sb.append(")");
return sb.toString();
}

public void validate() throws TException {
// check for required fields
}

}

Loading