Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.konfigthis.newscatcherapi.client.model.SearchRequest Maven / Gradle / Ivy
/*
* NewsCatcher-V3 Production API
* Visit our website https://newscatcherapi.com
*
* The version of the OpenAPI document: 3.2.16
* Contact: [email protected]
*
* NOTE: This class is auto generated by Konfig (https://konfigthis.com).
* Do not edit the class manually.
*/
package com.konfigthis.newscatcherapi.client.model;
import java.util.Objects;
import java.util.Arrays;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import org.openapitools.jackson.nullable.JsonNullable;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonArray;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParseException;
import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import org.apache.commons.lang3.StringUtils;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import com.konfigthis.newscatcherapi.client.JSON;
/**
* Search request DTO
*/
@ApiModel(description = "Search request DTO")@javax.annotation.Generated(value = "Generated by https://konfigthis.com")
public class SearchRequest {
public static final String SERIALIZED_NAME_Q = "q";
@SerializedName(SERIALIZED_NAME_Q)
private String q;
public static final String SERIALIZED_NAME_SEARCH_IN = "search_in";
@SerializedName(SERIALIZED_NAME_SEARCH_IN)
private String searchIn = "title_content";
public static final String SERIALIZED_NAME_PREDEFINED_SOURCES = "predefined_sources";
@SerializedName(SERIALIZED_NAME_PREDEFINED_SOURCES)
private Object predefinedSources = null;
public static final String SERIALIZED_NAME_SOURCES = "sources";
@SerializedName(SERIALIZED_NAME_SOURCES)
private Object sources = null;
public static final String SERIALIZED_NAME_NOT_SOURCES = "not_sources";
@SerializedName(SERIALIZED_NAME_NOT_SOURCES)
private Object notSources = null;
public static final String SERIALIZED_NAME_LANG = "lang";
@SerializedName(SERIALIZED_NAME_LANG)
private Object lang = null;
public static final String SERIALIZED_NAME_NOT_LANG = "not_lang";
@SerializedName(SERIALIZED_NAME_NOT_LANG)
private Object notLang = null;
public static final String SERIALIZED_NAME_COUNTRIES = "countries";
@SerializedName(SERIALIZED_NAME_COUNTRIES)
private Object countries = null;
public static final String SERIALIZED_NAME_NOT_COUNTRIES = "not_countries";
@SerializedName(SERIALIZED_NAME_NOT_COUNTRIES)
private Object notCountries = null;
public static final String SERIALIZED_NAME_NOT_AUTHOR_NAME = "not_author_name";
@SerializedName(SERIALIZED_NAME_NOT_AUTHOR_NAME)
private Object notAuthorName = null;
public static final String SERIALIZED_NAME_FROM = "from_";
@SerializedName(SERIALIZED_NAME_FROM)
private String from;
public static final String SERIALIZED_NAME_TO = "to_";
@SerializedName(SERIALIZED_NAME_TO)
private String to;
public static final String SERIALIZED_NAME_PUBLISHED_DATE_PRECISION = "published_date_precision";
@SerializedName(SERIALIZED_NAME_PUBLISHED_DATE_PRECISION)
private String publishedDatePrecision;
public static final String SERIALIZED_NAME_BY_PARSE_DATE = "by_parse_date";
@SerializedName(SERIALIZED_NAME_BY_PARSE_DATE)
private Boolean byParseDate = false;
public static final String SERIALIZED_NAME_SORT_BY = "sort_by";
@SerializedName(SERIALIZED_NAME_SORT_BY)
private String sortBy = "relevancy";
public static final String SERIALIZED_NAME_RANKED_ONLY = "ranked_only";
@SerializedName(SERIALIZED_NAME_RANKED_ONLY)
private Object rankedOnly = null;
public static final String SERIALIZED_NAME_FROM_RANK = "from_rank";
@SerializedName(SERIALIZED_NAME_FROM_RANK)
private Integer fromRank;
public static final String SERIALIZED_NAME_TO_RANK = "to_rank";
@SerializedName(SERIALIZED_NAME_TO_RANK)
private Integer toRank;
public static final String SERIALIZED_NAME_IS_HEADLINE = "is_headline";
@SerializedName(SERIALIZED_NAME_IS_HEADLINE)
private Boolean isHeadline;
public static final String SERIALIZED_NAME_IS_OPINION = "is_opinion";
@SerializedName(SERIALIZED_NAME_IS_OPINION)
private Boolean isOpinion;
public static final String SERIALIZED_NAME_IS_PAID_CONTENT = "is_paid_content";
@SerializedName(SERIALIZED_NAME_IS_PAID_CONTENT)
private Boolean isPaidContent;
public static final String SERIALIZED_NAME_PARENT_URL = "parent_url";
@SerializedName(SERIALIZED_NAME_PARENT_URL)
private Object parentUrl = null;
public static final String SERIALIZED_NAME_ALL_LINKS = "all_links";
@SerializedName(SERIALIZED_NAME_ALL_LINKS)
private Object allLinks = null;
public static final String SERIALIZED_NAME_ALL_DOMAIN_LINKS = "all_domain_links";
@SerializedName(SERIALIZED_NAME_ALL_DOMAIN_LINKS)
private Object allDomainLinks = null;
public static final String SERIALIZED_NAME_WORD_COUNT_MIN = "word_count_min";
@SerializedName(SERIALIZED_NAME_WORD_COUNT_MIN)
private Integer wordCountMin;
public static final String SERIALIZED_NAME_WORD_COUNT_MAX = "word_count_max";
@SerializedName(SERIALIZED_NAME_WORD_COUNT_MAX)
private Integer wordCountMax;
public static final String SERIALIZED_NAME_PAGE = "page";
@SerializedName(SERIALIZED_NAME_PAGE)
private Integer page = 1;
public static final String SERIALIZED_NAME_PAGE_SIZE = "page_size";
@SerializedName(SERIALIZED_NAME_PAGE_SIZE)
private Integer pageSize = 100;
public static final String SERIALIZED_NAME_CLUSTERING_VARIABLE = "clustering_variable";
@SerializedName(SERIALIZED_NAME_CLUSTERING_VARIABLE)
private String clusteringVariable;
public static final String SERIALIZED_NAME_CLUSTERING_ENABLED = "clustering_enabled";
@SerializedName(SERIALIZED_NAME_CLUSTERING_ENABLED)
private Boolean clusteringEnabled;
public static final String SERIALIZED_NAME_CLUSTERING_THRESHOLD = "clustering_threshold";
@SerializedName(SERIALIZED_NAME_CLUSTERING_THRESHOLD)
private Double clusteringThreshold;
public static final String SERIALIZED_NAME_INCLUDE_NLP_DATA = "include_nlp_data";
@SerializedName(SERIALIZED_NAME_INCLUDE_NLP_DATA)
private Boolean includeNlpData;
public static final String SERIALIZED_NAME_HAS_NLP = "has_nlp";
@SerializedName(SERIALIZED_NAME_HAS_NLP)
private Boolean hasNlp;
public static final String SERIALIZED_NAME_THEME = "theme";
@SerializedName(SERIALIZED_NAME_THEME)
private String theme;
public static final String SERIALIZED_NAME_NOT_THEME = "not_theme";
@SerializedName(SERIALIZED_NAME_NOT_THEME)
private String notTheme;
public static final String SERIALIZED_NAME_OR_G_ENTITY_NAME = "ORG_entity_name";
@SerializedName(SERIALIZED_NAME_OR_G_ENTITY_NAME)
private String orGEntityName;
public static final String SERIALIZED_NAME_PE_R_ENTITY_NAME = "PER_entity_name";
@SerializedName(SERIALIZED_NAME_PE_R_ENTITY_NAME)
private String peREntityName;
public static final String SERIALIZED_NAME_LO_C_ENTITY_NAME = "LOC_entity_name";
@SerializedName(SERIALIZED_NAME_LO_C_ENTITY_NAME)
private String loCEntityName;
public static final String SERIALIZED_NAME_MI_S_C_ENTITY_NAME = "MISC_entity_name";
@SerializedName(SERIALIZED_NAME_MI_S_C_ENTITY_NAME)
private String miSCEntityName;
public static final String SERIALIZED_NAME_TITLE_SENTIMENT_MIN = "title_sentiment_min";
@SerializedName(SERIALIZED_NAME_TITLE_SENTIMENT_MIN)
private Double titleSentimentMin;
public static final String SERIALIZED_NAME_TITLE_SENTIMENT_MAX = "title_sentiment_max";
@SerializedName(SERIALIZED_NAME_TITLE_SENTIMENT_MAX)
private Double titleSentimentMax;
public static final String SERIALIZED_NAME_CONTENT_SENTIMENT_MIN = "content_sentiment_min";
@SerializedName(SERIALIZED_NAME_CONTENT_SENTIMENT_MIN)
private Double contentSentimentMin;
public static final String SERIALIZED_NAME_CONTENT_SENTIMENT_MAX = "content_sentiment_max";
@SerializedName(SERIALIZED_NAME_CONTENT_SENTIMENT_MAX)
private Double contentSentimentMax;
public static final String SERIALIZED_NAME_IPTC_TAGS = "iptc_tags";
@SerializedName(SERIALIZED_NAME_IPTC_TAGS)
private Object iptcTags = null;
public static final String SERIALIZED_NAME_NOT_IPTC_TAGS = "not_iptc_tags";
@SerializedName(SERIALIZED_NAME_NOT_IPTC_TAGS)
private Object notIptcTags = null;
public static final String SERIALIZED_NAME_SOURCE_NAME = "source_name";
@SerializedName(SERIALIZED_NAME_SOURCE_NAME)
private Object sourceName = null;
public static final String SERIALIZED_NAME_IAB_TAGS = "iab_tags";
@SerializedName(SERIALIZED_NAME_IAB_TAGS)
private Object iabTags = null;
public static final String SERIALIZED_NAME_NOT_IAB_TAGS = "not_iab_tags";
@SerializedName(SERIALIZED_NAME_NOT_IAB_TAGS)
private Object notIabTags = null;
public static final String SERIALIZED_NAME_EXCLUDE_DUPLICATES = "exclude_duplicates";
@SerializedName(SERIALIZED_NAME_EXCLUDE_DUPLICATES)
private Boolean excludeDuplicates;
public SearchRequest() {
}
public SearchRequest q(String q) {
this.q = q;
return this;
}
/**
* Get q
* @return q
**/
@javax.annotation.Nonnull
@ApiModelProperty(required = true, value = "")
public String getQ() {
return q;
}
public void setQ(String q) {
this.q = q;
}
public SearchRequest searchIn(String searchIn) {
this.searchIn = searchIn;
return this;
}
/**
* Get searchIn
* @return searchIn
**/
@javax.annotation.Nullable
@ApiModelProperty(example = "title_content", value = "")
public String getSearchIn() {
return searchIn;
}
public void setSearchIn(String searchIn) {
this.searchIn = searchIn;
}
public SearchRequest predefinedSources(Object predefinedSources) {
this.predefinedSources = predefinedSources;
return this;
}
/**
* Get predefinedSources
* @return predefinedSources
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public Object getPredefinedSources() {
return predefinedSources;
}
public void setPredefinedSources(Object predefinedSources) {
this.predefinedSources = predefinedSources;
}
public SearchRequest sources(Object sources) {
this.sources = sources;
return this;
}
/**
* Get sources
* @return sources
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public Object getSources() {
return sources;
}
public void setSources(Object sources) {
this.sources = sources;
}
public SearchRequest notSources(Object notSources) {
this.notSources = notSources;
return this;
}
/**
* Get notSources
* @return notSources
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public Object getNotSources() {
return notSources;
}
public void setNotSources(Object notSources) {
this.notSources = notSources;
}
public SearchRequest lang(Object lang) {
this.lang = lang;
return this;
}
/**
* Get lang
* @return lang
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public Object getLang() {
return lang;
}
public void setLang(Object lang) {
this.lang = lang;
}
public SearchRequest notLang(Object notLang) {
this.notLang = notLang;
return this;
}
/**
* Get notLang
* @return notLang
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public Object getNotLang() {
return notLang;
}
public void setNotLang(Object notLang) {
this.notLang = notLang;
}
public SearchRequest countries(Object countries) {
this.countries = countries;
return this;
}
/**
* Get countries
* @return countries
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public Object getCountries() {
return countries;
}
public void setCountries(Object countries) {
this.countries = countries;
}
public SearchRequest notCountries(Object notCountries) {
this.notCountries = notCountries;
return this;
}
/**
* Get notCountries
* @return notCountries
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public Object getNotCountries() {
return notCountries;
}
public void setNotCountries(Object notCountries) {
this.notCountries = notCountries;
}
public SearchRequest notAuthorName(Object notAuthorName) {
this.notAuthorName = notAuthorName;
return this;
}
/**
* Get notAuthorName
* @return notAuthorName
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public Object getNotAuthorName() {
return notAuthorName;
}
public void setNotAuthorName(Object notAuthorName) {
this.notAuthorName = notAuthorName;
}
public SearchRequest from(String from) {
this.from = from;
return this;
}
/**
* Get from
* @return from
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public String getFrom() {
return from;
}
public void setFrom(String from) {
this.from = from;
}
public SearchRequest to(String to) {
this.to = to;
return this;
}
/**
* Get to
* @return to
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public String getTo() {
return to;
}
public void setTo(String to) {
this.to = to;
}
public SearchRequest publishedDatePrecision(String publishedDatePrecision) {
this.publishedDatePrecision = publishedDatePrecision;
return this;
}
/**
* Get publishedDatePrecision
* @return publishedDatePrecision
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public String getPublishedDatePrecision() {
return publishedDatePrecision;
}
public void setPublishedDatePrecision(String publishedDatePrecision) {
this.publishedDatePrecision = publishedDatePrecision;
}
public SearchRequest byParseDate(Boolean byParseDate) {
this.byParseDate = byParseDate;
return this;
}
/**
* Get byParseDate
* @return byParseDate
**/
@javax.annotation.Nullable
@ApiModelProperty(example = "false", value = "")
public Boolean getByParseDate() {
return byParseDate;
}
public void setByParseDate(Boolean byParseDate) {
this.byParseDate = byParseDate;
}
public SearchRequest sortBy(String sortBy) {
this.sortBy = sortBy;
return this;
}
/**
* Get sortBy
* @return sortBy
**/
@javax.annotation.Nullable
@ApiModelProperty(example = "relevancy", value = "")
public String getSortBy() {
return sortBy;
}
public void setSortBy(String sortBy) {
this.sortBy = sortBy;
}
public SearchRequest rankedOnly(Object rankedOnly) {
this.rankedOnly = rankedOnly;
return this;
}
/**
* Get rankedOnly
* @return rankedOnly
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public Object getRankedOnly() {
return rankedOnly;
}
public void setRankedOnly(Object rankedOnly) {
this.rankedOnly = rankedOnly;
}
public SearchRequest fromRank(Integer fromRank) {
this.fromRank = fromRank;
return this;
}
/**
* Get fromRank
* @return fromRank
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public Integer getFromRank() {
return fromRank;
}
public void setFromRank(Integer fromRank) {
this.fromRank = fromRank;
}
public SearchRequest toRank(Integer toRank) {
this.toRank = toRank;
return this;
}
/**
* Get toRank
* @return toRank
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public Integer getToRank() {
return toRank;
}
public void setToRank(Integer toRank) {
this.toRank = toRank;
}
public SearchRequest isHeadline(Boolean isHeadline) {
this.isHeadline = isHeadline;
return this;
}
/**
* Get isHeadline
* @return isHeadline
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public Boolean getIsHeadline() {
return isHeadline;
}
public void setIsHeadline(Boolean isHeadline) {
this.isHeadline = isHeadline;
}
public SearchRequest isOpinion(Boolean isOpinion) {
this.isOpinion = isOpinion;
return this;
}
/**
* Get isOpinion
* @return isOpinion
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public Boolean getIsOpinion() {
return isOpinion;
}
public void setIsOpinion(Boolean isOpinion) {
this.isOpinion = isOpinion;
}
public SearchRequest isPaidContent(Boolean isPaidContent) {
this.isPaidContent = isPaidContent;
return this;
}
/**
* Get isPaidContent
* @return isPaidContent
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public Boolean getIsPaidContent() {
return isPaidContent;
}
public void setIsPaidContent(Boolean isPaidContent) {
this.isPaidContent = isPaidContent;
}
public SearchRequest parentUrl(Object parentUrl) {
this.parentUrl = parentUrl;
return this;
}
/**
* Get parentUrl
* @return parentUrl
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public Object getParentUrl() {
return parentUrl;
}
public void setParentUrl(Object parentUrl) {
this.parentUrl = parentUrl;
}
public SearchRequest allLinks(Object allLinks) {
this.allLinks = allLinks;
return this;
}
/**
* Get allLinks
* @return allLinks
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public Object getAllLinks() {
return allLinks;
}
public void setAllLinks(Object allLinks) {
this.allLinks = allLinks;
}
public SearchRequest allDomainLinks(Object allDomainLinks) {
this.allDomainLinks = allDomainLinks;
return this;
}
/**
* Get allDomainLinks
* @return allDomainLinks
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public Object getAllDomainLinks() {
return allDomainLinks;
}
public void setAllDomainLinks(Object allDomainLinks) {
this.allDomainLinks = allDomainLinks;
}
public SearchRequest wordCountMin(Integer wordCountMin) {
if (wordCountMin != null && wordCountMin < 0) {
throw new IllegalArgumentException("Invalid value for wordCountMin. Must be greater than or equal to 0.");
}
this.wordCountMin = wordCountMin;
return this;
}
/**
* Get wordCountMin
* minimum: 0
* @return wordCountMin
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public Integer getWordCountMin() {
return wordCountMin;
}
public void setWordCountMin(Integer wordCountMin) {
if (wordCountMin != null && wordCountMin < 0) {
throw new IllegalArgumentException("Invalid value for wordCountMin. Must be greater than or equal to 0.");
}
this.wordCountMin = wordCountMin;
}
public SearchRequest wordCountMax(Integer wordCountMax) {
if (wordCountMax != null && wordCountMax < 0) {
throw new IllegalArgumentException("Invalid value for wordCountMax. Must be greater than or equal to 0.");
}
this.wordCountMax = wordCountMax;
return this;
}
/**
* Get wordCountMax
* minimum: 0
* @return wordCountMax
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public Integer getWordCountMax() {
return wordCountMax;
}
public void setWordCountMax(Integer wordCountMax) {
if (wordCountMax != null && wordCountMax < 0) {
throw new IllegalArgumentException("Invalid value for wordCountMax. Must be greater than or equal to 0.");
}
this.wordCountMax = wordCountMax;
}
public SearchRequest page(Integer page) {
if (page != null && page < 0) {
throw new IllegalArgumentException("Invalid value for page. Must be greater than or equal to 0.");
}
this.page = page;
return this;
}
/**
* Get page
* minimum: 0
* @return page
**/
@javax.annotation.Nullable
@ApiModelProperty(example = "1", value = "")
public Integer getPage() {
return page;
}
public void setPage(Integer page) {
if (page != null && page < 0) {
throw new IllegalArgumentException("Invalid value for page. Must be greater than or equal to 0.");
}
this.page = page;
}
public SearchRequest pageSize(Integer pageSize) {
if (pageSize != null && pageSize < 0) {
throw new IllegalArgumentException("Invalid value for pageSize. Must be greater than or equal to 0.");
}
this.pageSize = pageSize;
return this;
}
/**
* Get pageSize
* minimum: 0
* @return pageSize
**/
@javax.annotation.Nullable
@ApiModelProperty(example = "100", value = "")
public Integer getPageSize() {
return pageSize;
}
public void setPageSize(Integer pageSize) {
if (pageSize != null && pageSize < 0) {
throw new IllegalArgumentException("Invalid value for pageSize. Must be greater than or equal to 0.");
}
this.pageSize = pageSize;
}
public SearchRequest clusteringVariable(String clusteringVariable) {
this.clusteringVariable = clusteringVariable;
return this;
}
/**
* Get clusteringVariable
* @return clusteringVariable
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public String getClusteringVariable() {
return clusteringVariable;
}
public void setClusteringVariable(String clusteringVariable) {
this.clusteringVariable = clusteringVariable;
}
public SearchRequest clusteringEnabled(Boolean clusteringEnabled) {
this.clusteringEnabled = clusteringEnabled;
return this;
}
/**
* Get clusteringEnabled
* @return clusteringEnabled
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public Boolean getClusteringEnabled() {
return clusteringEnabled;
}
public void setClusteringEnabled(Boolean clusteringEnabled) {
this.clusteringEnabled = clusteringEnabled;
}
public SearchRequest clusteringThreshold(Double clusteringThreshold) {
this.clusteringThreshold = clusteringThreshold;
return this;
}
public SearchRequest clusteringThreshold(Integer clusteringThreshold) {
this.clusteringThreshold = clusteringThreshold.doubleValue();
return this;
}
/**
* Get clusteringThreshold
* @return clusteringThreshold
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public Double getClusteringThreshold() {
return clusteringThreshold;
}
public void setClusteringThreshold(Double clusteringThreshold) {
this.clusteringThreshold = clusteringThreshold;
}
public SearchRequest includeNlpData(Boolean includeNlpData) {
this.includeNlpData = includeNlpData;
return this;
}
/**
* Get includeNlpData
* @return includeNlpData
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public Boolean getIncludeNlpData() {
return includeNlpData;
}
public void setIncludeNlpData(Boolean includeNlpData) {
this.includeNlpData = includeNlpData;
}
public SearchRequest hasNlp(Boolean hasNlp) {
this.hasNlp = hasNlp;
return this;
}
/**
* Get hasNlp
* @return hasNlp
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public Boolean getHasNlp() {
return hasNlp;
}
public void setHasNlp(Boolean hasNlp) {
this.hasNlp = hasNlp;
}
public SearchRequest theme(String theme) {
this.theme = theme;
return this;
}
/**
* Get theme
* @return theme
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public String getTheme() {
return theme;
}
public void setTheme(String theme) {
this.theme = theme;
}
public SearchRequest notTheme(String notTheme) {
this.notTheme = notTheme;
return this;
}
/**
* Get notTheme
* @return notTheme
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public String getNotTheme() {
return notTheme;
}
public void setNotTheme(String notTheme) {
this.notTheme = notTheme;
}
public SearchRequest orGEntityName(String orGEntityName) {
this.orGEntityName = orGEntityName;
return this;
}
/**
* Get orGEntityName
* @return orGEntityName
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public String getOrGEntityName() {
return orGEntityName;
}
public void setOrGEntityName(String orGEntityName) {
this.orGEntityName = orGEntityName;
}
public SearchRequest peREntityName(String peREntityName) {
this.peREntityName = peREntityName;
return this;
}
/**
* Get peREntityName
* @return peREntityName
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public String getPeREntityName() {
return peREntityName;
}
public void setPeREntityName(String peREntityName) {
this.peREntityName = peREntityName;
}
public SearchRequest loCEntityName(String loCEntityName) {
this.loCEntityName = loCEntityName;
return this;
}
/**
* Get loCEntityName
* @return loCEntityName
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public String getLoCEntityName() {
return loCEntityName;
}
public void setLoCEntityName(String loCEntityName) {
this.loCEntityName = loCEntityName;
}
public SearchRequest miSCEntityName(String miSCEntityName) {
this.miSCEntityName = miSCEntityName;
return this;
}
/**
* Get miSCEntityName
* @return miSCEntityName
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public String getMiSCEntityName() {
return miSCEntityName;
}
public void setMiSCEntityName(String miSCEntityName) {
this.miSCEntityName = miSCEntityName;
}
public SearchRequest titleSentimentMin(Double titleSentimentMin) {
this.titleSentimentMin = titleSentimentMin;
return this;
}
public SearchRequest titleSentimentMin(Integer titleSentimentMin) {
this.titleSentimentMin = titleSentimentMin.doubleValue();
return this;
}
/**
* Get titleSentimentMin
* @return titleSentimentMin
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public Double getTitleSentimentMin() {
return titleSentimentMin;
}
public void setTitleSentimentMin(Double titleSentimentMin) {
this.titleSentimentMin = titleSentimentMin;
}
public SearchRequest titleSentimentMax(Double titleSentimentMax) {
this.titleSentimentMax = titleSentimentMax;
return this;
}
public SearchRequest titleSentimentMax(Integer titleSentimentMax) {
this.titleSentimentMax = titleSentimentMax.doubleValue();
return this;
}
/**
* Get titleSentimentMax
* @return titleSentimentMax
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public Double getTitleSentimentMax() {
return titleSentimentMax;
}
public void setTitleSentimentMax(Double titleSentimentMax) {
this.titleSentimentMax = titleSentimentMax;
}
public SearchRequest contentSentimentMin(Double contentSentimentMin) {
this.contentSentimentMin = contentSentimentMin;
return this;
}
public SearchRequest contentSentimentMin(Integer contentSentimentMin) {
this.contentSentimentMin = contentSentimentMin.doubleValue();
return this;
}
/**
* Get contentSentimentMin
* @return contentSentimentMin
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public Double getContentSentimentMin() {
return contentSentimentMin;
}
public void setContentSentimentMin(Double contentSentimentMin) {
this.contentSentimentMin = contentSentimentMin;
}
public SearchRequest contentSentimentMax(Double contentSentimentMax) {
this.contentSentimentMax = contentSentimentMax;
return this;
}
public SearchRequest contentSentimentMax(Integer contentSentimentMax) {
this.contentSentimentMax = contentSentimentMax.doubleValue();
return this;
}
/**
* Get contentSentimentMax
* @return contentSentimentMax
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public Double getContentSentimentMax() {
return contentSentimentMax;
}
public void setContentSentimentMax(Double contentSentimentMax) {
this.contentSentimentMax = contentSentimentMax;
}
public SearchRequest iptcTags(Object iptcTags) {
this.iptcTags = iptcTags;
return this;
}
/**
* Get iptcTags
* @return iptcTags
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public Object getIptcTags() {
return iptcTags;
}
public void setIptcTags(Object iptcTags) {
this.iptcTags = iptcTags;
}
public SearchRequest notIptcTags(Object notIptcTags) {
this.notIptcTags = notIptcTags;
return this;
}
/**
* Get notIptcTags
* @return notIptcTags
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public Object getNotIptcTags() {
return notIptcTags;
}
public void setNotIptcTags(Object notIptcTags) {
this.notIptcTags = notIptcTags;
}
public SearchRequest sourceName(Object sourceName) {
this.sourceName = sourceName;
return this;
}
/**
* Get sourceName
* @return sourceName
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public Object getSourceName() {
return sourceName;
}
public void setSourceName(Object sourceName) {
this.sourceName = sourceName;
}
public SearchRequest iabTags(Object iabTags) {
this.iabTags = iabTags;
return this;
}
/**
* Get iabTags
* @return iabTags
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public Object getIabTags() {
return iabTags;
}
public void setIabTags(Object iabTags) {
this.iabTags = iabTags;
}
public SearchRequest notIabTags(Object notIabTags) {
this.notIabTags = notIabTags;
return this;
}
/**
* Get notIabTags
* @return notIabTags
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public Object getNotIabTags() {
return notIabTags;
}
public void setNotIabTags(Object notIabTags) {
this.notIabTags = notIabTags;
}
public SearchRequest excludeDuplicates(Boolean excludeDuplicates) {
this.excludeDuplicates = excludeDuplicates;
return this;
}
/**
* Get excludeDuplicates
* @return excludeDuplicates
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public Boolean getExcludeDuplicates() {
return excludeDuplicates;
}
public void setExcludeDuplicates(Boolean excludeDuplicates) {
this.excludeDuplicates = excludeDuplicates;
}
/**
* A container for additional, undeclared properties.
* This is a holder for any undeclared properties as specified with
* the 'additionalProperties' keyword in the OAS document.
*/
private Map additionalProperties;
/**
* Set the additional (undeclared) property with the specified name and value.
* If the property does not already exist, create it otherwise replace it.
*
* @param key name of the property
* @param value value of the property
* @return the SearchRequest instance itself
*/
public SearchRequest putAdditionalProperty(String key, Object value) {
if (this.additionalProperties == null) {
this.additionalProperties = new HashMap();
}
this.additionalProperties.put(key, value);
return this;
}
/**
* Return the additional (undeclared) property.
*
* @return a map of objects
*/
public Map getAdditionalProperties() {
return additionalProperties;
}
/**
* Return the additional (undeclared) property with the specified name.
*
* @param key name of the property
* @return an object
*/
public Object getAdditionalProperty(String key) {
if (this.additionalProperties == null) {
return null;
}
return this.additionalProperties.get(key);
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
SearchRequest searchRequest = (SearchRequest) o;
return Objects.equals(this.q, searchRequest.q) &&
Objects.equals(this.searchIn, searchRequest.searchIn) &&
Objects.equals(this.predefinedSources, searchRequest.predefinedSources) &&
Objects.equals(this.sources, searchRequest.sources) &&
Objects.equals(this.notSources, searchRequest.notSources) &&
Objects.equals(this.lang, searchRequest.lang) &&
Objects.equals(this.notLang, searchRequest.notLang) &&
Objects.equals(this.countries, searchRequest.countries) &&
Objects.equals(this.notCountries, searchRequest.notCountries) &&
Objects.equals(this.notAuthorName, searchRequest.notAuthorName) &&
Objects.equals(this.from, searchRequest.from) &&
Objects.equals(this.to, searchRequest.to) &&
Objects.equals(this.publishedDatePrecision, searchRequest.publishedDatePrecision) &&
Objects.equals(this.byParseDate, searchRequest.byParseDate) &&
Objects.equals(this.sortBy, searchRequest.sortBy) &&
Objects.equals(this.rankedOnly, searchRequest.rankedOnly) &&
Objects.equals(this.fromRank, searchRequest.fromRank) &&
Objects.equals(this.toRank, searchRequest.toRank) &&
Objects.equals(this.isHeadline, searchRequest.isHeadline) &&
Objects.equals(this.isOpinion, searchRequest.isOpinion) &&
Objects.equals(this.isPaidContent, searchRequest.isPaidContent) &&
Objects.equals(this.parentUrl, searchRequest.parentUrl) &&
Objects.equals(this.allLinks, searchRequest.allLinks) &&
Objects.equals(this.allDomainLinks, searchRequest.allDomainLinks) &&
Objects.equals(this.wordCountMin, searchRequest.wordCountMin) &&
Objects.equals(this.wordCountMax, searchRequest.wordCountMax) &&
Objects.equals(this.page, searchRequest.page) &&
Objects.equals(this.pageSize, searchRequest.pageSize) &&
Objects.equals(this.clusteringVariable, searchRequest.clusteringVariable) &&
Objects.equals(this.clusteringEnabled, searchRequest.clusteringEnabled) &&
Objects.equals(this.clusteringThreshold, searchRequest.clusteringThreshold) &&
Objects.equals(this.includeNlpData, searchRequest.includeNlpData) &&
Objects.equals(this.hasNlp, searchRequest.hasNlp) &&
Objects.equals(this.theme, searchRequest.theme) &&
Objects.equals(this.notTheme, searchRequest.notTheme) &&
Objects.equals(this.orGEntityName, searchRequest.orGEntityName) &&
Objects.equals(this.peREntityName, searchRequest.peREntityName) &&
Objects.equals(this.loCEntityName, searchRequest.loCEntityName) &&
Objects.equals(this.miSCEntityName, searchRequest.miSCEntityName) &&
Objects.equals(this.titleSentimentMin, searchRequest.titleSentimentMin) &&
Objects.equals(this.titleSentimentMax, searchRequest.titleSentimentMax) &&
Objects.equals(this.contentSentimentMin, searchRequest.contentSentimentMin) &&
Objects.equals(this.contentSentimentMax, searchRequest.contentSentimentMax) &&
Objects.equals(this.iptcTags, searchRequest.iptcTags) &&
Objects.equals(this.notIptcTags, searchRequest.notIptcTags) &&
Objects.equals(this.sourceName, searchRequest.sourceName) &&
Objects.equals(this.iabTags, searchRequest.iabTags) &&
Objects.equals(this.notIabTags, searchRequest.notIabTags) &&
Objects.equals(this.excludeDuplicates, searchRequest.excludeDuplicates)&&
Objects.equals(this.additionalProperties, searchRequest.additionalProperties);
}
private static boolean equalsNullable(JsonNullable a, JsonNullable b) {
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get()));
}
@Override
public int hashCode() {
return Objects.hash(q, searchIn, predefinedSources, sources, notSources, lang, notLang, countries, notCountries, notAuthorName, from, to, publishedDatePrecision, byParseDate, sortBy, rankedOnly, fromRank, toRank, isHeadline, isOpinion, isPaidContent, parentUrl, allLinks, allDomainLinks, wordCountMin, wordCountMax, page, pageSize, clusteringVariable, clusteringEnabled, clusteringThreshold, includeNlpData, hasNlp, theme, notTheme, orGEntityName, peREntityName, loCEntityName, miSCEntityName, titleSentimentMin, titleSentimentMax, contentSentimentMin, contentSentimentMax, iptcTags, notIptcTags, sourceName, iabTags, notIabTags, excludeDuplicates, additionalProperties);
}
private static int hashCodeNullable(JsonNullable a) {
if (a == null) {
return 1;
}
return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class SearchRequest {\n");
sb.append(" q: ").append(toIndentedString(q)).append("\n");
sb.append(" searchIn: ").append(toIndentedString(searchIn)).append("\n");
sb.append(" predefinedSources: ").append(toIndentedString(predefinedSources)).append("\n");
sb.append(" sources: ").append(toIndentedString(sources)).append("\n");
sb.append(" notSources: ").append(toIndentedString(notSources)).append("\n");
sb.append(" lang: ").append(toIndentedString(lang)).append("\n");
sb.append(" notLang: ").append(toIndentedString(notLang)).append("\n");
sb.append(" countries: ").append(toIndentedString(countries)).append("\n");
sb.append(" notCountries: ").append(toIndentedString(notCountries)).append("\n");
sb.append(" notAuthorName: ").append(toIndentedString(notAuthorName)).append("\n");
sb.append(" from: ").append(toIndentedString(from)).append("\n");
sb.append(" to: ").append(toIndentedString(to)).append("\n");
sb.append(" publishedDatePrecision: ").append(toIndentedString(publishedDatePrecision)).append("\n");
sb.append(" byParseDate: ").append(toIndentedString(byParseDate)).append("\n");
sb.append(" sortBy: ").append(toIndentedString(sortBy)).append("\n");
sb.append(" rankedOnly: ").append(toIndentedString(rankedOnly)).append("\n");
sb.append(" fromRank: ").append(toIndentedString(fromRank)).append("\n");
sb.append(" toRank: ").append(toIndentedString(toRank)).append("\n");
sb.append(" isHeadline: ").append(toIndentedString(isHeadline)).append("\n");
sb.append(" isOpinion: ").append(toIndentedString(isOpinion)).append("\n");
sb.append(" isPaidContent: ").append(toIndentedString(isPaidContent)).append("\n");
sb.append(" parentUrl: ").append(toIndentedString(parentUrl)).append("\n");
sb.append(" allLinks: ").append(toIndentedString(allLinks)).append("\n");
sb.append(" allDomainLinks: ").append(toIndentedString(allDomainLinks)).append("\n");
sb.append(" wordCountMin: ").append(toIndentedString(wordCountMin)).append("\n");
sb.append(" wordCountMax: ").append(toIndentedString(wordCountMax)).append("\n");
sb.append(" page: ").append(toIndentedString(page)).append("\n");
sb.append(" pageSize: ").append(toIndentedString(pageSize)).append("\n");
sb.append(" clusteringVariable: ").append(toIndentedString(clusteringVariable)).append("\n");
sb.append(" clusteringEnabled: ").append(toIndentedString(clusteringEnabled)).append("\n");
sb.append(" clusteringThreshold: ").append(toIndentedString(clusteringThreshold)).append("\n");
sb.append(" includeNlpData: ").append(toIndentedString(includeNlpData)).append("\n");
sb.append(" hasNlp: ").append(toIndentedString(hasNlp)).append("\n");
sb.append(" theme: ").append(toIndentedString(theme)).append("\n");
sb.append(" notTheme: ").append(toIndentedString(notTheme)).append("\n");
sb.append(" orGEntityName: ").append(toIndentedString(orGEntityName)).append("\n");
sb.append(" peREntityName: ").append(toIndentedString(peREntityName)).append("\n");
sb.append(" loCEntityName: ").append(toIndentedString(loCEntityName)).append("\n");
sb.append(" miSCEntityName: ").append(toIndentedString(miSCEntityName)).append("\n");
sb.append(" titleSentimentMin: ").append(toIndentedString(titleSentimentMin)).append("\n");
sb.append(" titleSentimentMax: ").append(toIndentedString(titleSentimentMax)).append("\n");
sb.append(" contentSentimentMin: ").append(toIndentedString(contentSentimentMin)).append("\n");
sb.append(" contentSentimentMax: ").append(toIndentedString(contentSentimentMax)).append("\n");
sb.append(" iptcTags: ").append(toIndentedString(iptcTags)).append("\n");
sb.append(" notIptcTags: ").append(toIndentedString(notIptcTags)).append("\n");
sb.append(" sourceName: ").append(toIndentedString(sourceName)).append("\n");
sb.append(" iabTags: ").append(toIndentedString(iabTags)).append("\n");
sb.append(" notIabTags: ").append(toIndentedString(notIabTags)).append("\n");
sb.append(" excludeDuplicates: ").append(toIndentedString(excludeDuplicates)).append("\n");
sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
public static HashSet openapiFields;
public static HashSet openapiRequiredFields;
static {
// a set of all properties/fields (JSON key names)
openapiFields = new HashSet();
openapiFields.add("q");
openapiFields.add("search_in");
openapiFields.add("predefined_sources");
openapiFields.add("sources");
openapiFields.add("not_sources");
openapiFields.add("lang");
openapiFields.add("not_lang");
openapiFields.add("countries");
openapiFields.add("not_countries");
openapiFields.add("not_author_name");
openapiFields.add("from_");
openapiFields.add("to_");
openapiFields.add("published_date_precision");
openapiFields.add("by_parse_date");
openapiFields.add("sort_by");
openapiFields.add("ranked_only");
openapiFields.add("from_rank");
openapiFields.add("to_rank");
openapiFields.add("is_headline");
openapiFields.add("is_opinion");
openapiFields.add("is_paid_content");
openapiFields.add("parent_url");
openapiFields.add("all_links");
openapiFields.add("all_domain_links");
openapiFields.add("word_count_min");
openapiFields.add("word_count_max");
openapiFields.add("page");
openapiFields.add("page_size");
openapiFields.add("clustering_variable");
openapiFields.add("clustering_enabled");
openapiFields.add("clustering_threshold");
openapiFields.add("include_nlp_data");
openapiFields.add("has_nlp");
openapiFields.add("theme");
openapiFields.add("not_theme");
openapiFields.add("ORG_entity_name");
openapiFields.add("PER_entity_name");
openapiFields.add("LOC_entity_name");
openapiFields.add("MISC_entity_name");
openapiFields.add("title_sentiment_min");
openapiFields.add("title_sentiment_max");
openapiFields.add("content_sentiment_min");
openapiFields.add("content_sentiment_max");
openapiFields.add("iptc_tags");
openapiFields.add("not_iptc_tags");
openapiFields.add("source_name");
openapiFields.add("iab_tags");
openapiFields.add("not_iab_tags");
openapiFields.add("exclude_duplicates");
// a set of required properties/fields (JSON key names)
openapiRequiredFields = new HashSet();
openapiRequiredFields.add("q");
}
/**
* Validates the JSON Object and throws an exception if issues found
*
* @param jsonObj JSON Object
* @throws IOException if the JSON Object is invalid with respect to SearchRequest
*/
public static void validateJsonObject(JsonObject jsonObj) throws IOException {
if (jsonObj == null) {
if (!SearchRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null
throw new IllegalArgumentException(String.format("The required field(s) %s in SearchRequest is not found in the empty JSON string", SearchRequest.openapiRequiredFields.toString()));
}
}
// check to make sure all required properties/fields are present in the JSON string
for (String requiredField : SearchRequest.openapiRequiredFields) {
if (jsonObj.get(requiredField) == null) {
throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonObj.toString()));
}
}
if (!jsonObj.get("q").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `q` to be a primitive type in the JSON string but got `%s`", jsonObj.get("q").toString()));
}
if ((jsonObj.get("search_in") != null && !jsonObj.get("search_in").isJsonNull()) && !jsonObj.get("search_in").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `search_in` to be a primitive type in the JSON string but got `%s`", jsonObj.get("search_in").toString()));
}
if ((jsonObj.get("from_") != null && !jsonObj.get("from_").isJsonNull()) && !jsonObj.get("from_").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `from_` to be a primitive type in the JSON string but got `%s`", jsonObj.get("from_").toString()));
}
if ((jsonObj.get("to_") != null && !jsonObj.get("to_").isJsonNull()) && !jsonObj.get("to_").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `to_` to be a primitive type in the JSON string but got `%s`", jsonObj.get("to_").toString()));
}
if ((jsonObj.get("published_date_precision") != null && !jsonObj.get("published_date_precision").isJsonNull()) && !jsonObj.get("published_date_precision").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `published_date_precision` to be a primitive type in the JSON string but got `%s`", jsonObj.get("published_date_precision").toString()));
}
if ((jsonObj.get("sort_by") != null && !jsonObj.get("sort_by").isJsonNull()) && !jsonObj.get("sort_by").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `sort_by` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sort_by").toString()));
}
if ((jsonObj.get("clustering_variable") != null && !jsonObj.get("clustering_variable").isJsonNull()) && !jsonObj.get("clustering_variable").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `clustering_variable` to be a primitive type in the JSON string but got `%s`", jsonObj.get("clustering_variable").toString()));
}
if ((jsonObj.get("theme") != null && !jsonObj.get("theme").isJsonNull()) && !jsonObj.get("theme").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `theme` to be a primitive type in the JSON string but got `%s`", jsonObj.get("theme").toString()));
}
if ((jsonObj.get("not_theme") != null && !jsonObj.get("not_theme").isJsonNull()) && !jsonObj.get("not_theme").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `not_theme` to be a primitive type in the JSON string but got `%s`", jsonObj.get("not_theme").toString()));
}
if ((jsonObj.get("ORG_entity_name") != null && !jsonObj.get("ORG_entity_name").isJsonNull()) && !jsonObj.get("ORG_entity_name").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `ORG_entity_name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ORG_entity_name").toString()));
}
if ((jsonObj.get("PER_entity_name") != null && !jsonObj.get("PER_entity_name").isJsonNull()) && !jsonObj.get("PER_entity_name").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `PER_entity_name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("PER_entity_name").toString()));
}
if ((jsonObj.get("LOC_entity_name") != null && !jsonObj.get("LOC_entity_name").isJsonNull()) && !jsonObj.get("LOC_entity_name").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `LOC_entity_name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("LOC_entity_name").toString()));
}
if ((jsonObj.get("MISC_entity_name") != null && !jsonObj.get("MISC_entity_name").isJsonNull()) && !jsonObj.get("MISC_entity_name").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `MISC_entity_name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("MISC_entity_name").toString()));
}
}
public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
@SuppressWarnings("unchecked")
@Override
public TypeAdapter create(Gson gson, TypeToken type) {
if (!SearchRequest.class.isAssignableFrom(type.getRawType())) {
return null; // this class only serializes 'SearchRequest' and its subtypes
}
final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter thisAdapter
= gson.getDelegateAdapter(this, TypeToken.get(SearchRequest.class));
return (TypeAdapter) new TypeAdapter() {
@Override
public void write(JsonWriter out, SearchRequest value) throws IOException {
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
obj.remove("additionalProperties");
// serialize additonal properties
if (value.getAdditionalProperties() != null) {
for (Map.Entry entry : value.getAdditionalProperties().entrySet()) {
if (entry.getValue() instanceof String)
obj.addProperty(entry.getKey(), (String) entry.getValue());
else if (entry.getValue() instanceof Number)
obj.addProperty(entry.getKey(), (Number) entry.getValue());
else if (entry.getValue() instanceof Boolean)
obj.addProperty(entry.getKey(), (Boolean) entry.getValue());
else if (entry.getValue() instanceof Character)
obj.addProperty(entry.getKey(), (Character) entry.getValue());
else if (entry.getValue() == null) {
obj.addProperty(entry.getKey(), (String) null);
} else {
obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject());
}
}
}
elementAdapter.write(out, obj);
}
@Override
public SearchRequest read(JsonReader in) throws IOException {
JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject();
validateJsonObject(jsonObj);
// store additional fields in the deserialized instance
SearchRequest instance = thisAdapter.fromJsonTree(jsonObj);
for (Map.Entry entry : jsonObj.entrySet()) {
if (!openapiFields.contains(entry.getKey())) {
if (entry.getValue().isJsonPrimitive()) { // primitive type
if (entry.getValue().getAsJsonPrimitive().isString())
instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString());
else if (entry.getValue().getAsJsonPrimitive().isNumber())
instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber());
else if (entry.getValue().getAsJsonPrimitive().isBoolean())
instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean());
else
throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString()));
} else if (entry.getValue().isJsonArray()) {
instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class));
} else { // JSON object
instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class));
}
}
}
return instance;
}
}.nullSafe();
}
}
/**
* Create an instance of SearchRequest given an JSON string
*
* @param jsonString JSON string
* @return An instance of SearchRequest
* @throws IOException if the JSON string is invalid with respect to SearchRequest
*/
public static SearchRequest fromJson(String jsonString) throws IOException {
return JSON.getGson().fromJson(jsonString, SearchRequest.class);
}
/**
* Convert an instance of SearchRequest to an JSON string
*
* @return JSON string
*/
public String toJson() {
return JSON.getGson().toJson(this);
}
}