/**
* Autogenerated by Thrift
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
*/
package com.dgrid.gen;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.Set;
import java.util.HashSet;
import com.facebook.thrift.*;
import com.facebook.thrift.protocol.*;
import com.facebook.thrift.transport.*;
public class Host implements TBase, java.io.Serializable {
private int id;
private String hostname;
private Map<String,String> facts;
public final Isset __isset = new Isset();
public static final class Isset implements java.io.Serializable {
public boolean id = false;
public boolean hostname = false;
public boolean facts = false;
}
public Host() {
}
public Host(
int id,
String hostname,
Map<String,String> facts)
{
this();
this.id = id;
this.__isset.id = true;
this.hostname = hostname;
this.__isset.hostname = true;
this.facts = facts;
this.__isset.facts = true;
}
public int getId() {
return this.id;
}
public void setId(int id) {
this.id = id;
this.__isset.id = true;
}
public void unsetId() {
this.__isset.id = false;
}
public String getHostname() {
return this.hostname;
}
public void setHostname(String hostname) {
this.hostname = hostname;
this.__isset.hostname = true;
}
public void unsetHostname() {
this.__isset.hostname = false;
}
public int getFactsSize() {
return (this.facts == null) ? 0 : this.facts.size();
}
public void putToFacts(String key, String val) {
if (this.facts == null) {
this.facts = new HashMap<String,String>();
}
this.facts.put(key, val);
this.__isset.facts = true;
}
public Map<String,String> getFacts() {
return this.facts;
}
public void setFacts(Map<String,String> facts) {
this.facts = facts;
this.__isset.facts = true;
}
public void unsetFacts() {
this.facts = null;
this.__isset.facts = false;
}
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof Host)
return this.equals((Host)that);
return false;
}
public boolean equals(Host that) {
if (that == null)
return false;
boolean this_present_id = true;
boolean that_present_id = true;
if (this_present_id || that_present_id) {
if (!(this_present_id && that_present_id))
return false;
if (this.id != that.id)
return false;
}
boolean this_present_hostname = true && (this.hostname != null);
boolean that_present_hostname = true && (that.hostname != null);
if (this_present_hostname || that_present_hostname) {
if (!(this_present_hostname && that_present_hostname))
return false;
if (!this.hostname.equals(that.hostname))
return false;
}
boolean this_present_facts = true && (this.facts != null);
boolean that_present_facts = true && (that.facts != null);
if (this_present_facts || that_present_facts) {
if (!(this_present_facts && that_present_facts))
return false;
if (!this.facts.equals(that.facts))
return false;
}
return true;
}
public int hashCode() {
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:
if (field.type == TType.I32) {
this.id = iprot.readI32();
this.__isset.id = true;
} else {
TProtocolUtil.skip(iprot, field.type);
}
break;
case 2:
if (field.type == TType.STRING) {
this.hostname = iprot.readString();
this.__isset.hostname = true;
} else {
TProtocolUtil.skip(iprot, field.type);
}
break;
case 3:
if (field.type == TType.MAP) {
{
TMap _map0 = iprot.readMapBegin();
this.facts = new HashMap<String,String>(2*_map0.size);
for (int _i1 = 0; _i1 < _map0.size; ++_i1)
{
String _key2;
String _val3;
_key2 = iprot.readString();
_val3 = iprot.readString();
this.facts.put(_key2, _val3);
}
iprot.readMapEnd();
}
this.__isset.facts = true;
} else {
TProtocolUtil.skip(iprot, field.type);
}
break;
default:
TProtocolUtil.skip(iprot, field.type);
break;
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
}
public void write(TProtocol oprot) throws TException {
TStruct struct = new TStruct("Host");
oprot.writeStructBegin(struct);
TField field = new TField();
field.name = "id";
field.type = TType.I32;
field.id = 1;
oprot.writeFieldBegin(field);
oprot.writeI32(this.id);
oprot.writeFieldEnd();
if (this.hostname != null) {
field.name = "hostname";
field.type = TType.STRING;
field.id = 2;
oprot.writeFieldBegin(field);
oprot.writeString(this.hostname);
oprot.writeFieldEnd();
}
if (this.facts != null) {
field.name = "facts";
field.type = TType.MAP;
field.id = 3;
oprot.writeFieldBegin(field);
{
oprot.writeMapBegin(new TMap(TType.STRING, TType.STRING, this.facts.size()));
for (String _iter4 : this.facts.keySet()) {
oprot.writeString(_iter4);
oprot.writeString(this.facts.get(_iter4));
}
oprot.writeMapEnd();
}
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
public String toString() {
StringBuilder sb = new StringBuilder("Host(");
sb.append("id:");
sb.append(this.id);
sb.append(",hostname:");
sb.append(this.hostname);
sb.append(",facts:");
sb.append(this.facts);
sb.append(")");
return sb.toString();
}
}