com.evernote.edam.type.Publishing 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 has been opened to the public, the Notebook will have a
* reference to one of these structures, which gives the location and optional
* description of the externally-visible public Notebook.
*
* - uri
* - If this field is present, then the notebook is published for
* mass consumption on the Internet under the provided URI, which is
* relative to a defined base publishing URI defined by the service.
* This field can only be modified via the web service GUI ... publishing
* cannot be modified via an offline client.
*
* Length: EDAM_PUBLISHING_URI_LEN_MIN - EDAM_PUBLISHING_URI_LEN_MAX
*
* Regex: EDAM_PUBLISHING_URI_REGEX
*
*
* - order
* - When the notes are publicly displayed, they will be sorted
* based on the requested criteria.
*
*
* - ascending
* - If this is set to true, then the public notes will be
* displayed in ascending order (e.g. from oldest to newest). Otherwise,
* the notes will be displayed in descending order (e.g. newest to oldest).
*
*
* - publicDescription
* - This field may be used to provide a short
* description of the notebook, which may be displayed when (e.g.) the
* notebook is shown in a public view. Can't begin or end with a space.
*
* Length: EDAM_PUBLISHING_DESCRIPTION_LEN_MIN -
* EDAM_PUBLISHING_DESCRIPTION_LEN_MAX
*
* Regex: EDAM_PUBLISHING_DESCRIPTION_REGEX
*
*
*
*/
public class Publishing implements TBase, java.io.Serializable, Cloneable {
private static final TStruct STRUCT_DESC = new TStruct("Publishing");
private static final TField URI_FIELD_DESC = new TField("uri", TType.STRING, (short)1);
private static final TField ORDER_FIELD_DESC = new TField("order", TType.I32, (short)2);
private static final TField ASCENDING_FIELD_DESC = new TField("ascending", TType.BOOL, (short)3);
private static final TField PUBLIC_DESCRIPTION_FIELD_DESC = new TField("publicDescription", TType.STRING, (short)4);
private String uri;
private NoteSortOrder order;
private boolean ascending;
private String publicDescription;
// isset id assignments
private static final int __ASCENDING_ISSET_ID = 0;
private boolean[] __isset_vector = new boolean[1];
public Publishing() {
}
/**
* Performs a deep copy on other.
*/
public Publishing(Publishing other) {
System.arraycopy(other.__isset_vector, 0, __isset_vector, 0, other.__isset_vector.length);
if (other.isSetUri()) {
this.uri = other.uri;
}
if (other.isSetOrder()) {
this.order = other.order;
}
this.ascending = other.ascending;
if (other.isSetPublicDescription()) {
this.publicDescription = other.publicDescription;
}
}
public Publishing deepCopy() {
return new Publishing(this);
}
public void clear() {
this.uri = null;
this.order = null;
setAscendingIsSet(false);
this.ascending = false;
this.publicDescription = null;
}
public String getUri() {
return this.uri;
}
public void setUri(String uri) {
this.uri = uri;
}
public void unsetUri() {
this.uri = null;
}
/** Returns true if field uri is set (has been asigned a value) and false otherwise */
public boolean isSetUri() {
return this.uri != null;
}
public void setUriIsSet(boolean value) {
if (!value) {
this.uri = null;
}
}
/**
*
* @see NoteSortOrder
*/
public NoteSortOrder getOrder() {
return this.order;
}
/**
*
* @see NoteSortOrder
*/
public void setOrder(NoteSortOrder order) {
this.order = order;
}
public void unsetOrder() {
this.order = null;
}
/** Returns true if field order is set (has been asigned a value) and false otherwise */
public boolean isSetOrder() {
return this.order != null;
}
public void setOrderIsSet(boolean value) {
if (!value) {
this.order = null;
}
}
public boolean isAscending() {
return this.ascending;
}
public void setAscending(boolean ascending) {
this.ascending = ascending;
setAscendingIsSet(true);
}
public void unsetAscending() {
__isset_vector[__ASCENDING_ISSET_ID] = false;
}
/** Returns true if field ascending is set (has been asigned a value) and false otherwise */
public boolean isSetAscending() {
return __isset_vector[__ASCENDING_ISSET_ID];
}
public void setAscendingIsSet(boolean value) {
__isset_vector[__ASCENDING_ISSET_ID] = value;
}
public String getPublicDescription() {
return this.publicDescription;
}
public void setPublicDescription(String publicDescription) {
this.publicDescription = publicDescription;
}
public void unsetPublicDescription() {
this.publicDescription = null;
}
/** Returns true if field publicDescription is set (has been asigned a value) and false otherwise */
public boolean isSetPublicDescription() {
return this.publicDescription != null;
}
public void setPublicDescriptionIsSet(boolean value) {
if (!value) {
this.publicDescription = null;
}
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof Publishing)
return this.equals((Publishing)that);
return false;
}
public boolean equals(Publishing that) {
if (that == null)
return false;
boolean this_present_uri = true && this.isSetUri();
boolean that_present_uri = true && that.isSetUri();
if (this_present_uri || that_present_uri) {
if (!(this_present_uri && that_present_uri))
return false;
if (!this.uri.equals(that.uri))
return false;
}
boolean this_present_order = true && this.isSetOrder();
boolean that_present_order = true && that.isSetOrder();
if (this_present_order || that_present_order) {
if (!(this_present_order && that_present_order))
return false;
if (!this.order.equals(that.order))
return false;
}
boolean this_present_ascending = true && this.isSetAscending();
boolean that_present_ascending = true && that.isSetAscending();
if (this_present_ascending || that_present_ascending) {
if (!(this_present_ascending && that_present_ascending))
return false;
if (this.ascending != that.ascending)
return false;
}
boolean this_present_publicDescription = true && this.isSetPublicDescription();
boolean that_present_publicDescription = true && that.isSetPublicDescription();
if (this_present_publicDescription || that_present_publicDescription) {
if (!(this_present_publicDescription && that_present_publicDescription))
return false;
if (!this.publicDescription.equals(that.publicDescription))
return false;
}
return true;
}
@Override
public int hashCode() {
return 0;
}
public int compareTo(Publishing other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
Publishing typedOther = (Publishing)other;
lastComparison = Boolean.valueOf(isSetUri()).compareTo(typedOther.isSetUri());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetUri()) { lastComparison = TBaseHelper.compareTo(this.uri, typedOther.uri);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetOrder()).compareTo(typedOther.isSetOrder());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetOrder()) { lastComparison = TBaseHelper.compareTo(this.order, typedOther.order);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetAscending()).compareTo(typedOther.isSetAscending());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetAscending()) { lastComparison = TBaseHelper.compareTo(this.ascending, typedOther.ascending);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetPublicDescription()).compareTo(typedOther.isSetPublicDescription());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetPublicDescription()) { lastComparison = TBaseHelper.compareTo(this.publicDescription, typedOther.publicDescription);
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: // URI
if (field.type == TType.STRING) {
this.uri = iprot.readString();
} else {
TProtocolUtil.skip(iprot, field.type);
}
break;
case 2: // ORDER
if (field.type == TType.I32) {
this.order = NoteSortOrder.findByValue(iprot.readI32());
} else {
TProtocolUtil.skip(iprot, field.type);
}
break;
case 3: // ASCENDING
if (field.type == TType.BOOL) {
this.ascending = iprot.readBool();
setAscendingIsSet(true);
} else {
TProtocolUtil.skip(iprot, field.type);
}
break;
case 4: // PUBLIC_DESCRIPTION
if (field.type == TType.STRING) {
this.publicDescription = iprot.readString();
} 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.uri != null) {
if (isSetUri()) {
oprot.writeFieldBegin(URI_FIELD_DESC);
oprot.writeString(this.uri);
oprot.writeFieldEnd();
}
}
if (this.order != null) {
if (isSetOrder()) {
oprot.writeFieldBegin(ORDER_FIELD_DESC);
oprot.writeI32(this.order.getValue());
oprot.writeFieldEnd();
}
}
if (isSetAscending()) {
oprot.writeFieldBegin(ASCENDING_FIELD_DESC);
oprot.writeBool(this.ascending);
oprot.writeFieldEnd();
}
if (this.publicDescription != null) {
if (isSetPublicDescription()) {
oprot.writeFieldBegin(PUBLIC_DESCRIPTION_FIELD_DESC);
oprot.writeString(this.publicDescription);
oprot.writeFieldEnd();
}
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("Publishing(");
boolean first = true;
if (isSetUri()) {
sb.append("uri:");
if (this.uri == null) {
sb.append("null");
} else {
sb.append(this.uri);
}
first = false;
}
if (isSetOrder()) {
if (!first) sb.append(", ");
sb.append("order:");
if (this.order == null) {
sb.append("null");
} else {
sb.append(this.order);
}
first = false;
}
if (isSetAscending()) {
if (!first) sb.append(", ");
sb.append("ascending:");
sb.append(this.ascending);
first = false;
}
if (isSetPublicDescription()) {
if (!first) sb.append(", ");
sb.append("publicDescription:");
if (this.publicDescription == null) {
sb.append("null");
} else {
sb.append(this.publicDescription);
}
first = false;
}
sb.append(")");
return sb.toString();
}
public void validate() throws TException {
// check for required fields
}
}