com.evernote.edam.type.BusinessNotebook Maven / Gradle / Ivy
The newest version!
/**
* Autogenerated by Thrift
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
*/
package com.evernote.edam.type;
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.evernote.thrift.*;
import com.evernote.thrift.protocol.*;
/**
* If a Notebook contained in an Evernote Business account has been published
* the to business library, the Notebook will have a reference to one of these
* structures, which specifies how the Notebook will be represented in the
* library.
*
*
* - notebookDescription
* - A short description of the notebook's content that will be displayed
* in the business library user interface. The description may not begin
* or end with whitespace.
*
* Length: EDAM_BUSINESS_NOTEBOOK_DESCRIPTION_LEN_MIN -
* EDAM_BUSINESS_NOTEBOOK_DESCRIPTION_LEN_MAX
*
* Regex: EDAM_BUSINESS_NOTEBOOK_DESCRIPTION_REGEX
*
*
* - privilege
* - The privileges that will be granted to users who join the notebook through
* the business library.
*
*
* - recommended
* - Whether the notebook should be "recommended" when displayed in the business
* library user interface.
*
*
*/
public class BusinessNotebook implements TBase, java.io.Serializable, Cloneable {
private static final TStruct STRUCT_DESC = new TStruct("BusinessNotebook");
private static final TField NOTEBOOK_DESCRIPTION_FIELD_DESC = new TField("notebookDescription", TType.STRING, (short)1);
private static final TField PRIVILEGE_FIELD_DESC = new TField("privilege", TType.I32, (short)2);
private static final TField RECOMMENDED_FIELD_DESC = new TField("recommended", TType.BOOL, (short)3);
private String notebookDescription;
private SharedNotebookPrivilegeLevel privilege;
private boolean recommended;
// isset id assignments
private static final int __RECOMMENDED_ISSET_ID = 0;
private boolean[] __isset_vector = new boolean[1];
public BusinessNotebook() {
}
/**
* Performs a deep copy on other.
*/
public BusinessNotebook(BusinessNotebook other) {
System.arraycopy(other.__isset_vector, 0, __isset_vector, 0, other.__isset_vector.length);
if (other.isSetNotebookDescription()) {
this.notebookDescription = other.notebookDescription;
}
if (other.isSetPrivilege()) {
this.privilege = other.privilege;
}
this.recommended = other.recommended;
}
public BusinessNotebook deepCopy() {
return new BusinessNotebook(this);
}
public void clear() {
this.notebookDescription = null;
this.privilege = null;
setRecommendedIsSet(false);
this.recommended = false;
}
public String getNotebookDescription() {
return this.notebookDescription;
}
public void setNotebookDescription(String notebookDescription) {
this.notebookDescription = notebookDescription;
}
public void unsetNotebookDescription() {
this.notebookDescription = null;
}
/** Returns true if field notebookDescription is set (has been asigned a value) and false otherwise */
public boolean isSetNotebookDescription() {
return this.notebookDescription != null;
}
public void setNotebookDescriptionIsSet(boolean value) {
if (!value) {
this.notebookDescription = null;
}
}
/**
*
* @see SharedNotebookPrivilegeLevel
*/
public SharedNotebookPrivilegeLevel getPrivilege() {
return this.privilege;
}
/**
*
* @see SharedNotebookPrivilegeLevel
*/
public void setPrivilege(SharedNotebookPrivilegeLevel privilege) {
this.privilege = privilege;
}
public void unsetPrivilege() {
this.privilege = null;
}
/** Returns true if field privilege is set (has been asigned a value) and false otherwise */
public boolean isSetPrivilege() {
return this.privilege != null;
}
public void setPrivilegeIsSet(boolean value) {
if (!value) {
this.privilege = null;
}
}
public boolean isRecommended() {
return this.recommended;
}
public void setRecommended(boolean recommended) {
this.recommended = recommended;
setRecommendedIsSet(true);
}
public void unsetRecommended() {
__isset_vector[__RECOMMENDED_ISSET_ID] = false;
}
/** Returns true if field recommended is set (has been asigned a value) and false otherwise */
public boolean isSetRecommended() {
return __isset_vector[__RECOMMENDED_ISSET_ID];
}
public void setRecommendedIsSet(boolean value) {
__isset_vector[__RECOMMENDED_ISSET_ID] = value;
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof BusinessNotebook)
return this.equals((BusinessNotebook)that);
return false;
}
public boolean equals(BusinessNotebook that) {
if (that == null)
return false;
boolean this_present_notebookDescription = true && this.isSetNotebookDescription();
boolean that_present_notebookDescription = true && that.isSetNotebookDescription();
if (this_present_notebookDescription || that_present_notebookDescription) {
if (!(this_present_notebookDescription && that_present_notebookDescription))
return false;
if (!this.notebookDescription.equals(that.notebookDescription))
return false;
}
boolean this_present_privilege = true && this.isSetPrivilege();
boolean that_present_privilege = true && that.isSetPrivilege();
if (this_present_privilege || that_present_privilege) {
if (!(this_present_privilege && that_present_privilege))
return false;
if (!this.privilege.equals(that.privilege))
return false;
}
boolean this_present_recommended = true && this.isSetRecommended();
boolean that_present_recommended = true && that.isSetRecommended();
if (this_present_recommended || that_present_recommended) {
if (!(this_present_recommended && that_present_recommended))
return false;
if (this.recommended != that.recommended)
return false;
}
return true;
}
@Override
public int hashCode() {
return 0;
}
public int compareTo(BusinessNotebook other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
BusinessNotebook typedOther = (BusinessNotebook)other;
lastComparison = Boolean.valueOf(isSetNotebookDescription()).compareTo(typedOther.isSetNotebookDescription());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetNotebookDescription()) { lastComparison = TBaseHelper.compareTo(this.notebookDescription, typedOther.notebookDescription);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetPrivilege()).compareTo(typedOther.isSetPrivilege());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetPrivilege()) { lastComparison = TBaseHelper.compareTo(this.privilege, typedOther.privilege);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetRecommended()).compareTo(typedOther.isSetRecommended());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetRecommended()) { lastComparison = TBaseHelper.compareTo(this.recommended, typedOther.recommended);
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: // NOTEBOOK_DESCRIPTION
if (field.type == TType.STRING) {
this.notebookDescription = iprot.readString();
} else {
TProtocolUtil.skip(iprot, field.type);
}
break;
case 2: // PRIVILEGE
if (field.type == TType.I32) {
this.privilege = SharedNotebookPrivilegeLevel.findByValue(iprot.readI32());
} else {
TProtocolUtil.skip(iprot, field.type);
}
break;
case 3: // RECOMMENDED
if (field.type == TType.BOOL) {
this.recommended = iprot.readBool();
setRecommendedIsSet(true);
} else {
TProtocolUtil.skip(iprot, field.type);
}
break;
default:
TProtocolUtil.skip(iprot, field.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
validate();
}
public void write(TProtocol oprot) throws TException {
validate();
oprot.writeStructBegin(STRUCT_DESC);
if (this.notebookDescription != null) {
if (isSetNotebookDescription()) {
oprot.writeFieldBegin(NOTEBOOK_DESCRIPTION_FIELD_DESC);
oprot.writeString(this.notebookDescription);
oprot.writeFieldEnd();
}
}
if (this.privilege != null) {
if (isSetPrivilege()) {
oprot.writeFieldBegin(PRIVILEGE_FIELD_DESC);
oprot.writeI32(this.privilege.getValue());
oprot.writeFieldEnd();
}
}
if (isSetRecommended()) {
oprot.writeFieldBegin(RECOMMENDED_FIELD_DESC);
oprot.writeBool(this.recommended);
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("BusinessNotebook(");
boolean first = true;
if (isSetNotebookDescription()) {
sb.append("notebookDescription:");
if (this.notebookDescription == null) {
sb.append("null");
} else {
sb.append(this.notebookDescription);
}
first = false;
}
if (isSetPrivilege()) {
if (!first) sb.append(", ");
sb.append("privilege:");
if (this.privilege == null) {
sb.append("null");
} else {
sb.append(this.privilege);
}
first = false;
}
if (isSetRecommended()) {
if (!first) sb.append(", ");
sb.append("recommended:");
sb.append(this.recommended);
first = false;
}
sb.append(")");
return sb.toString();
}
public void validate() throws TException {
// check for required fields
}
}