All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.konfigthis.newscatcherapi.client.model.ArticlesPropertyInner1 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 com.konfigthis.newscatcherapi.client.model.SimilarDocument1; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.util.ArrayList; import java.util.List; 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; /** * ArticlesPropertyInner1 */@javax.annotation.Generated(value = "Generated by https://konfigthis.com") public class ArticlesPropertyInner1 { public static final String SERIALIZED_NAME_TITLE = "title"; @SerializedName(SERIALIZED_NAME_TITLE) private String title; public static final String SERIALIZED_NAME_DESCRIPTION = "description"; @SerializedName(SERIALIZED_NAME_DESCRIPTION) private String description; public static final String SERIALIZED_NAME_AUTHOR = "author"; @SerializedName(SERIALIZED_NAME_AUTHOR) private String author; public static final String SERIALIZED_NAME_AUTHORS = "authors"; @SerializedName(SERIALIZED_NAME_AUTHORS) private Object authors = null; public static final String SERIALIZED_NAME_JOURNALISTS = "journalists"; @SerializedName(SERIALIZED_NAME_JOURNALISTS) private Object journalists = null; public static final String SERIALIZED_NAME_PUBLISHED_DATE = "published_date"; @SerializedName(SERIALIZED_NAME_PUBLISHED_DATE) private String publishedDate; 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_UPDATED_DATE = "updated_date"; @SerializedName(SERIALIZED_NAME_UPDATED_DATE) private String updatedDate; public static final String SERIALIZED_NAME_UPDATED_DATE_PRECISION = "updated_date_precision"; @SerializedName(SERIALIZED_NAME_UPDATED_DATE_PRECISION) private String updatedDatePrecision; public static final String SERIALIZED_NAME_PARSE_DATE = "parse_date"; @SerializedName(SERIALIZED_NAME_PARSE_DATE) private String parseDate; public static final String SERIALIZED_NAME_LINK = "link"; @SerializedName(SERIALIZED_NAME_LINK) private String link; public static final String SERIALIZED_NAME_DOMAIN_URL = "domain_url"; @SerializedName(SERIALIZED_NAME_DOMAIN_URL) private String domainUrl; public static final String SERIALIZED_NAME_FULL_DOMAIN_URL = "full_domain_url"; @SerializedName(SERIALIZED_NAME_FULL_DOMAIN_URL) private String fullDomainUrl; public static final String SERIALIZED_NAME_NAME_SOURCE = "name_source"; @SerializedName(SERIALIZED_NAME_NAME_SOURCE) private String nameSource; public static final String SERIALIZED_NAME_IS_HEADLINE = "is_headline"; @SerializedName(SERIALIZED_NAME_IS_HEADLINE) private String isHeadline; public static final String SERIALIZED_NAME_PAID_CONTENT = "paid_content"; @SerializedName(SERIALIZED_NAME_PAID_CONTENT) private Boolean paidContent; public static final String SERIALIZED_NAME_EXTRACTION_DATA = "extraction_data"; @SerializedName(SERIALIZED_NAME_EXTRACTION_DATA) private String extractionData; public static final String SERIALIZED_NAME_COUNTRY = "country"; @SerializedName(SERIALIZED_NAME_COUNTRY) private String country; public static final String SERIALIZED_NAME_RIGHTS = "rights"; @SerializedName(SERIALIZED_NAME_RIGHTS) private String rights; public static final String SERIALIZED_NAME_RANK = "rank"; @SerializedName(SERIALIZED_NAME_RANK) private Integer rank; public static final String SERIALIZED_NAME_MEDIA = "media"; @SerializedName(SERIALIZED_NAME_MEDIA) private String media; public static final String SERIALIZED_NAME_LANGUAGE = "language"; @SerializedName(SERIALIZED_NAME_LANGUAGE) private String language; public static final String SERIALIZED_NAME_CONTENT = "content"; @SerializedName(SERIALIZED_NAME_CONTENT) private String content; public static final String SERIALIZED_NAME_TITLE_TRANSLATED_EN = "title_translated_en"; @SerializedName(SERIALIZED_NAME_TITLE_TRANSLATED_EN) private String titleTranslatedEn; public static final String SERIALIZED_NAME_CONTENT_TRANSLATED_EN = "content_translated_en"; @SerializedName(SERIALIZED_NAME_CONTENT_TRANSLATED_EN) private String contentTranslatedEn; public static final String SERIALIZED_NAME_WORD_COUNT = "word_count"; @SerializedName(SERIALIZED_NAME_WORD_COUNT) private Integer wordCount = 0; public static final String SERIALIZED_NAME_IS_OPINION = "is_opinion"; @SerializedName(SERIALIZED_NAME_IS_OPINION) private Boolean isOpinion; public static final String SERIALIZED_NAME_TWITTER_ACCOUNT = "twitter_account"; @SerializedName(SERIALIZED_NAME_TWITTER_ACCOUNT) private String twitterAccount; 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_NLP = "nlp"; @SerializedName(SERIALIZED_NAME_NLP) private Object nlp; public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) private String id; public static final String SERIALIZED_NAME_SCORE = "score"; @SerializedName(SERIALIZED_NAME_SCORE) private Double score; public static final String SERIALIZED_NAME_SIMILAR_DOCUMENTS = "similar_documents"; @SerializedName(SERIALIZED_NAME_SIMILAR_DOCUMENTS) private List similarDocuments = null; public ArticlesPropertyInner1() { } public ArticlesPropertyInner1 title(String title) { this.title = title; return this; } /** * Get title * @return title **/ @javax.annotation.Nullable @ApiModelProperty(value = "") public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public ArticlesPropertyInner1 description(String description) { this.description = description; return this; } /** * Get description * @return description **/ @javax.annotation.Nullable @ApiModelProperty(value = "") public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public ArticlesPropertyInner1 author(String author) { this.author = author; return this; } /** * Get author * @return author **/ @javax.annotation.Nullable @ApiModelProperty(value = "") public String getAuthor() { return author; } public void setAuthor(String author) { this.author = author; } public ArticlesPropertyInner1 authors(Object authors) { this.authors = authors; return this; } /** * Get authors * @return authors **/ @javax.annotation.Nullable @ApiModelProperty(value = "") public Object getAuthors() { return authors; } public void setAuthors(Object authors) { this.authors = authors; } public ArticlesPropertyInner1 journalists(Object journalists) { this.journalists = journalists; return this; } /** * Get journalists * @return journalists **/ @javax.annotation.Nullable @ApiModelProperty(value = "") public Object getJournalists() { return journalists; } public void setJournalists(Object journalists) { this.journalists = journalists; } public ArticlesPropertyInner1 publishedDate(String publishedDate) { this.publishedDate = publishedDate; return this; } /** * Get publishedDate * @return publishedDate **/ @javax.annotation.Nullable @ApiModelProperty(value = "") public String getPublishedDate() { return publishedDate; } public void setPublishedDate(String publishedDate) { this.publishedDate = publishedDate; } public ArticlesPropertyInner1 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 ArticlesPropertyInner1 updatedDate(String updatedDate) { this.updatedDate = updatedDate; return this; } /** * Get updatedDate * @return updatedDate **/ @javax.annotation.Nullable @ApiModelProperty(value = "") public String getUpdatedDate() { return updatedDate; } public void setUpdatedDate(String updatedDate) { this.updatedDate = updatedDate; } public ArticlesPropertyInner1 updatedDatePrecision(String updatedDatePrecision) { this.updatedDatePrecision = updatedDatePrecision; return this; } /** * Get updatedDatePrecision * @return updatedDatePrecision **/ @javax.annotation.Nullable @ApiModelProperty(value = "") public String getUpdatedDatePrecision() { return updatedDatePrecision; } public void setUpdatedDatePrecision(String updatedDatePrecision) { this.updatedDatePrecision = updatedDatePrecision; } public ArticlesPropertyInner1 parseDate(String parseDate) { this.parseDate = parseDate; return this; } /** * Get parseDate * @return parseDate **/ @javax.annotation.Nullable @ApiModelProperty(value = "") public String getParseDate() { return parseDate; } public void setParseDate(String parseDate) { this.parseDate = parseDate; } public ArticlesPropertyInner1 link(String link) { this.link = link; return this; } /** * Get link * @return link **/ @javax.annotation.Nullable @ApiModelProperty(value = "") public String getLink() { return link; } public void setLink(String link) { this.link = link; } public ArticlesPropertyInner1 domainUrl(String domainUrl) { this.domainUrl = domainUrl; return this; } /** * Get domainUrl * @return domainUrl **/ @javax.annotation.Nullable @ApiModelProperty(value = "") public String getDomainUrl() { return domainUrl; } public void setDomainUrl(String domainUrl) { this.domainUrl = domainUrl; } public ArticlesPropertyInner1 fullDomainUrl(String fullDomainUrl) { this.fullDomainUrl = fullDomainUrl; return this; } /** * Get fullDomainUrl * @return fullDomainUrl **/ @javax.annotation.Nullable @ApiModelProperty(value = "") public String getFullDomainUrl() { return fullDomainUrl; } public void setFullDomainUrl(String fullDomainUrl) { this.fullDomainUrl = fullDomainUrl; } public ArticlesPropertyInner1 nameSource(String nameSource) { this.nameSource = nameSource; return this; } /** * Get nameSource * @return nameSource **/ @javax.annotation.Nullable @ApiModelProperty(value = "") public String getNameSource() { return nameSource; } public void setNameSource(String nameSource) { this.nameSource = nameSource; } public ArticlesPropertyInner1 isHeadline(String isHeadline) { this.isHeadline = isHeadline; return this; } /** * Get isHeadline * @return isHeadline **/ @javax.annotation.Nullable @ApiModelProperty(value = "") public String getIsHeadline() { return isHeadline; } public void setIsHeadline(String isHeadline) { this.isHeadline = isHeadline; } public ArticlesPropertyInner1 paidContent(Boolean paidContent) { this.paidContent = paidContent; return this; } /** * Get paidContent * @return paidContent **/ @javax.annotation.Nullable @ApiModelProperty(value = "") public Boolean getPaidContent() { return paidContent; } public void setPaidContent(Boolean paidContent) { this.paidContent = paidContent; } public ArticlesPropertyInner1 extractionData(String extractionData) { this.extractionData = extractionData; return this; } /** * Get extractionData * @return extractionData **/ @javax.annotation.Nullable @ApiModelProperty(value = "") public String getExtractionData() { return extractionData; } public void setExtractionData(String extractionData) { this.extractionData = extractionData; } public ArticlesPropertyInner1 country(String country) { this.country = country; return this; } /** * Get country * @return country **/ @javax.annotation.Nullable @ApiModelProperty(value = "") public String getCountry() { return country; } public void setCountry(String country) { this.country = country; } public ArticlesPropertyInner1 rights(String rights) { this.rights = rights; return this; } /** * Get rights * @return rights **/ @javax.annotation.Nullable @ApiModelProperty(value = "") public String getRights() { return rights; } public void setRights(String rights) { this.rights = rights; } public ArticlesPropertyInner1 rank(Integer rank) { this.rank = rank; return this; } /** * Get rank * @return rank **/ @javax.annotation.Nullable @ApiModelProperty(value = "") public Integer getRank() { return rank; } public void setRank(Integer rank) { this.rank = rank; } public ArticlesPropertyInner1 media(String media) { this.media = media; return this; } /** * Get media * @return media **/ @javax.annotation.Nullable @ApiModelProperty(value = "") public String getMedia() { return media; } public void setMedia(String media) { this.media = media; } public ArticlesPropertyInner1 language(String language) { this.language = language; return this; } /** * Get language * @return language **/ @javax.annotation.Nullable @ApiModelProperty(value = "") public String getLanguage() { return language; } public void setLanguage(String language) { this.language = language; } public ArticlesPropertyInner1 content(String content) { this.content = content; return this; } /** * Get content * @return content **/ @javax.annotation.Nullable @ApiModelProperty(value = "") public String getContent() { return content; } public void setContent(String content) { this.content = content; } public ArticlesPropertyInner1 titleTranslatedEn(String titleTranslatedEn) { this.titleTranslatedEn = titleTranslatedEn; return this; } /** * Get titleTranslatedEn * @return titleTranslatedEn **/ @javax.annotation.Nullable @ApiModelProperty(value = "") public String getTitleTranslatedEn() { return titleTranslatedEn; } public void setTitleTranslatedEn(String titleTranslatedEn) { this.titleTranslatedEn = titleTranslatedEn; } public ArticlesPropertyInner1 contentTranslatedEn(String contentTranslatedEn) { this.contentTranslatedEn = contentTranslatedEn; return this; } /** * Get contentTranslatedEn * @return contentTranslatedEn **/ @javax.annotation.Nullable @ApiModelProperty(value = "") public String getContentTranslatedEn() { return contentTranslatedEn; } public void setContentTranslatedEn(String contentTranslatedEn) { this.contentTranslatedEn = contentTranslatedEn; } public ArticlesPropertyInner1 wordCount(Integer wordCount) { this.wordCount = wordCount; return this; } /** * Get wordCount * @return wordCount **/ @javax.annotation.Nullable @ApiModelProperty(example = "0", value = "") public Integer getWordCount() { return wordCount; } public void setWordCount(Integer wordCount) { this.wordCount = wordCount; } public ArticlesPropertyInner1 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 ArticlesPropertyInner1 twitterAccount(String twitterAccount) { this.twitterAccount = twitterAccount; return this; } /** * Get twitterAccount * @return twitterAccount **/ @javax.annotation.Nullable @ApiModelProperty(value = "") public String getTwitterAccount() { return twitterAccount; } public void setTwitterAccount(String twitterAccount) { this.twitterAccount = twitterAccount; } public ArticlesPropertyInner1 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 ArticlesPropertyInner1 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 ArticlesPropertyInner1 nlp(Object nlp) { this.nlp = nlp; return this; } /** * Get nlp * @return nlp **/ @javax.annotation.Nullable @ApiModelProperty(example = "{}", value = "") public Object getNlp() { return nlp; } public void setNlp(Object nlp) { this.nlp = nlp; } public ArticlesPropertyInner1 id(String id) { this.id = id; return this; } /** * Get id * @return id **/ @javax.annotation.Nullable @ApiModelProperty(value = "") public String getId() { return id; } public void setId(String id) { this.id = id; } public ArticlesPropertyInner1 score(Double score) { this.score = score; return this; } public ArticlesPropertyInner1 score(Integer score) { this.score = score.doubleValue(); return this; } /** * Get score * @return score **/ @javax.annotation.Nullable @ApiModelProperty(value = "") public Double getScore() { return score; } public void setScore(Double score) { this.score = score; } public ArticlesPropertyInner1 similarDocuments(List similarDocuments) { this.similarDocuments = similarDocuments; return this; } public ArticlesPropertyInner1 addSimilarDocumentsItem(SimilarDocument1 similarDocumentsItem) { if (this.similarDocuments == null) { this.similarDocuments = new ArrayList<>(); } this.similarDocuments.add(similarDocumentsItem); return this; } /** * Get similarDocuments * @return similarDocuments **/ @javax.annotation.Nullable @ApiModelProperty(example = "[]", value = "") public List getSimilarDocuments() { return similarDocuments; } public void setSimilarDocuments(List similarDocuments) { this.similarDocuments = similarDocuments; } /** * 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 ArticlesPropertyInner1 instance itself */ public ArticlesPropertyInner1 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; } ArticlesPropertyInner1 articlesPropertyInner1 = (ArticlesPropertyInner1) o; return Objects.equals(this.title, articlesPropertyInner1.title) && Objects.equals(this.description, articlesPropertyInner1.description) && Objects.equals(this.author, articlesPropertyInner1.author) && Objects.equals(this.authors, articlesPropertyInner1.authors) && Objects.equals(this.journalists, articlesPropertyInner1.journalists) && Objects.equals(this.publishedDate, articlesPropertyInner1.publishedDate) && Objects.equals(this.publishedDatePrecision, articlesPropertyInner1.publishedDatePrecision) && Objects.equals(this.updatedDate, articlesPropertyInner1.updatedDate) && Objects.equals(this.updatedDatePrecision, articlesPropertyInner1.updatedDatePrecision) && Objects.equals(this.parseDate, articlesPropertyInner1.parseDate) && Objects.equals(this.link, articlesPropertyInner1.link) && Objects.equals(this.domainUrl, articlesPropertyInner1.domainUrl) && Objects.equals(this.fullDomainUrl, articlesPropertyInner1.fullDomainUrl) && Objects.equals(this.nameSource, articlesPropertyInner1.nameSource) && Objects.equals(this.isHeadline, articlesPropertyInner1.isHeadline) && Objects.equals(this.paidContent, articlesPropertyInner1.paidContent) && Objects.equals(this.extractionData, articlesPropertyInner1.extractionData) && Objects.equals(this.country, articlesPropertyInner1.country) && Objects.equals(this.rights, articlesPropertyInner1.rights) && Objects.equals(this.rank, articlesPropertyInner1.rank) && Objects.equals(this.media, articlesPropertyInner1.media) && Objects.equals(this.language, articlesPropertyInner1.language) && Objects.equals(this.content, articlesPropertyInner1.content) && Objects.equals(this.titleTranslatedEn, articlesPropertyInner1.titleTranslatedEn) && Objects.equals(this.contentTranslatedEn, articlesPropertyInner1.contentTranslatedEn) && Objects.equals(this.wordCount, articlesPropertyInner1.wordCount) && Objects.equals(this.isOpinion, articlesPropertyInner1.isOpinion) && Objects.equals(this.twitterAccount, articlesPropertyInner1.twitterAccount) && Objects.equals(this.allLinks, articlesPropertyInner1.allLinks) && Objects.equals(this.allDomainLinks, articlesPropertyInner1.allDomainLinks) && Objects.equals(this.nlp, articlesPropertyInner1.nlp) && Objects.equals(this.id, articlesPropertyInner1.id) && Objects.equals(this.score, articlesPropertyInner1.score) && Objects.equals(this.similarDocuments, articlesPropertyInner1.similarDocuments)&& Objects.equals(this.additionalProperties, articlesPropertyInner1.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(title, description, author, authors, journalists, publishedDate, publishedDatePrecision, updatedDate, updatedDatePrecision, parseDate, link, domainUrl, fullDomainUrl, nameSource, isHeadline, paidContent, extractionData, country, rights, rank, media, language, content, titleTranslatedEn, contentTranslatedEn, wordCount, isOpinion, twitterAccount, allLinks, allDomainLinks, nlp, id, score, similarDocuments, 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 ArticlesPropertyInner1 {\n"); sb.append(" title: ").append(toIndentedString(title)).append("\n"); sb.append(" description: ").append(toIndentedString(description)).append("\n"); sb.append(" author: ").append(toIndentedString(author)).append("\n"); sb.append(" authors: ").append(toIndentedString(authors)).append("\n"); sb.append(" journalists: ").append(toIndentedString(journalists)).append("\n"); sb.append(" publishedDate: ").append(toIndentedString(publishedDate)).append("\n"); sb.append(" publishedDatePrecision: ").append(toIndentedString(publishedDatePrecision)).append("\n"); sb.append(" updatedDate: ").append(toIndentedString(updatedDate)).append("\n"); sb.append(" updatedDatePrecision: ").append(toIndentedString(updatedDatePrecision)).append("\n"); sb.append(" parseDate: ").append(toIndentedString(parseDate)).append("\n"); sb.append(" link: ").append(toIndentedString(link)).append("\n"); sb.append(" domainUrl: ").append(toIndentedString(domainUrl)).append("\n"); sb.append(" fullDomainUrl: ").append(toIndentedString(fullDomainUrl)).append("\n"); sb.append(" nameSource: ").append(toIndentedString(nameSource)).append("\n"); sb.append(" isHeadline: ").append(toIndentedString(isHeadline)).append("\n"); sb.append(" paidContent: ").append(toIndentedString(paidContent)).append("\n"); sb.append(" extractionData: ").append(toIndentedString(extractionData)).append("\n"); sb.append(" country: ").append(toIndentedString(country)).append("\n"); sb.append(" rights: ").append(toIndentedString(rights)).append("\n"); sb.append(" rank: ").append(toIndentedString(rank)).append("\n"); sb.append(" media: ").append(toIndentedString(media)).append("\n"); sb.append(" language: ").append(toIndentedString(language)).append("\n"); sb.append(" content: ").append(toIndentedString(content)).append("\n"); sb.append(" titleTranslatedEn: ").append(toIndentedString(titleTranslatedEn)).append("\n"); sb.append(" contentTranslatedEn: ").append(toIndentedString(contentTranslatedEn)).append("\n"); sb.append(" wordCount: ").append(toIndentedString(wordCount)).append("\n"); sb.append(" isOpinion: ").append(toIndentedString(isOpinion)).append("\n"); sb.append(" twitterAccount: ").append(toIndentedString(twitterAccount)).append("\n"); sb.append(" allLinks: ").append(toIndentedString(allLinks)).append("\n"); sb.append(" allDomainLinks: ").append(toIndentedString(allDomainLinks)).append("\n"); sb.append(" nlp: ").append(toIndentedString(nlp)).append("\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" score: ").append(toIndentedString(score)).append("\n"); sb.append(" similarDocuments: ").append(toIndentedString(similarDocuments)).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("title"); openapiFields.add("description"); openapiFields.add("author"); openapiFields.add("authors"); openapiFields.add("journalists"); openapiFields.add("published_date"); openapiFields.add("published_date_precision"); openapiFields.add("updated_date"); openapiFields.add("updated_date_precision"); openapiFields.add("parse_date"); openapiFields.add("link"); openapiFields.add("domain_url"); openapiFields.add("full_domain_url"); openapiFields.add("name_source"); openapiFields.add("is_headline"); openapiFields.add("paid_content"); openapiFields.add("extraction_data"); openapiFields.add("country"); openapiFields.add("rights"); openapiFields.add("rank"); openapiFields.add("media"); openapiFields.add("language"); openapiFields.add("content"); openapiFields.add("title_translated_en"); openapiFields.add("content_translated_en"); openapiFields.add("word_count"); openapiFields.add("is_opinion"); openapiFields.add("twitter_account"); openapiFields.add("all_links"); openapiFields.add("all_domain_links"); openapiFields.add("nlp"); openapiFields.add("id"); openapiFields.add("score"); openapiFields.add("similar_documents"); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet(); } /** * 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 ArticlesPropertyInner1 */ public static void validateJsonObject(JsonObject jsonObj) throws IOException { if (jsonObj == null) { if (!ArticlesPropertyInner1.openapiRequiredFields.isEmpty()) { // has required fields but JSON object is null throw new IllegalArgumentException(String.format("The required field(s) %s in ArticlesPropertyInner1 is not found in the empty JSON string", ArticlesPropertyInner1.openapiRequiredFields.toString())); } } if ((jsonObj.get("title") != null && !jsonObj.get("title").isJsonNull()) && !jsonObj.get("title").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `title` to be a primitive type in the JSON string but got `%s`", jsonObj.get("title").toString())); } if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); } if ((jsonObj.get("author") != null && !jsonObj.get("author").isJsonNull()) && !jsonObj.get("author").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `author` to be a primitive type in the JSON string but got `%s`", jsonObj.get("author").toString())); } if ((jsonObj.get("published_date") != null && !jsonObj.get("published_date").isJsonNull()) && !jsonObj.get("published_date").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `published_date` to be a primitive type in the JSON string but got `%s`", jsonObj.get("published_date").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("updated_date") != null && !jsonObj.get("updated_date").isJsonNull()) && !jsonObj.get("updated_date").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `updated_date` to be a primitive type in the JSON string but got `%s`", jsonObj.get("updated_date").toString())); } if ((jsonObj.get("updated_date_precision") != null && !jsonObj.get("updated_date_precision").isJsonNull()) && !jsonObj.get("updated_date_precision").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `updated_date_precision` to be a primitive type in the JSON string but got `%s`", jsonObj.get("updated_date_precision").toString())); } if ((jsonObj.get("parse_date") != null && !jsonObj.get("parse_date").isJsonNull()) && !jsonObj.get("parse_date").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `parse_date` to be a primitive type in the JSON string but got `%s`", jsonObj.get("parse_date").toString())); } if ((jsonObj.get("link") != null && !jsonObj.get("link").isJsonNull()) && !jsonObj.get("link").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `link` to be a primitive type in the JSON string but got `%s`", jsonObj.get("link").toString())); } if ((jsonObj.get("domain_url") != null && !jsonObj.get("domain_url").isJsonNull()) && !jsonObj.get("domain_url").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `domain_url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("domain_url").toString())); } if ((jsonObj.get("full_domain_url") != null && !jsonObj.get("full_domain_url").isJsonNull()) && !jsonObj.get("full_domain_url").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `full_domain_url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("full_domain_url").toString())); } if ((jsonObj.get("name_source") != null && !jsonObj.get("name_source").isJsonNull()) && !jsonObj.get("name_source").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `name_source` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name_source").toString())); } if ((jsonObj.get("is_headline") != null && !jsonObj.get("is_headline").isJsonNull()) && !jsonObj.get("is_headline").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `is_headline` to be a primitive type in the JSON string but got `%s`", jsonObj.get("is_headline").toString())); } if ((jsonObj.get("extraction_data") != null && !jsonObj.get("extraction_data").isJsonNull()) && !jsonObj.get("extraction_data").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `extraction_data` to be a primitive type in the JSON string but got `%s`", jsonObj.get("extraction_data").toString())); } if ((jsonObj.get("country") != null && !jsonObj.get("country").isJsonNull()) && !jsonObj.get("country").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `country` to be a primitive type in the JSON string but got `%s`", jsonObj.get("country").toString())); } if ((jsonObj.get("rights") != null && !jsonObj.get("rights").isJsonNull()) && !jsonObj.get("rights").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `rights` to be a primitive type in the JSON string but got `%s`", jsonObj.get("rights").toString())); } if ((jsonObj.get("media") != null && !jsonObj.get("media").isJsonNull()) && !jsonObj.get("media").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `media` to be a primitive type in the JSON string but got `%s`", jsonObj.get("media").toString())); } if ((jsonObj.get("language") != null && !jsonObj.get("language").isJsonNull()) && !jsonObj.get("language").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `language` to be a primitive type in the JSON string but got `%s`", jsonObj.get("language").toString())); } if ((jsonObj.get("content") != null && !jsonObj.get("content").isJsonNull()) && !jsonObj.get("content").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `content` to be a primitive type in the JSON string but got `%s`", jsonObj.get("content").toString())); } if ((jsonObj.get("title_translated_en") != null && !jsonObj.get("title_translated_en").isJsonNull()) && !jsonObj.get("title_translated_en").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `title_translated_en` to be a primitive type in the JSON string but got `%s`", jsonObj.get("title_translated_en").toString())); } if ((jsonObj.get("content_translated_en") != null && !jsonObj.get("content_translated_en").isJsonNull()) && !jsonObj.get("content_translated_en").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `content_translated_en` to be a primitive type in the JSON string but got `%s`", jsonObj.get("content_translated_en").toString())); } if ((jsonObj.get("twitter_account") != null && !jsonObj.get("twitter_account").isJsonNull()) && !jsonObj.get("twitter_account").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `twitter_account` to be a primitive type in the JSON string but got `%s`", jsonObj.get("twitter_account").toString())); } if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); } if (jsonObj.get("similar_documents") != null && !jsonObj.get("similar_documents").isJsonNull()) { JsonArray jsonArraysimilarDocuments = jsonObj.getAsJsonArray("similar_documents"); if (jsonArraysimilarDocuments != null) { // ensure the json data is an array if (!jsonObj.get("similar_documents").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `similar_documents` to be an array in the JSON string but got `%s`", jsonObj.get("similar_documents").toString())); } // validate the optional field `similar_documents` (array) for (int i = 0; i < jsonArraysimilarDocuments.size(); i++) { SimilarDocument1.validateJsonObject(jsonArraysimilarDocuments.get(i).getAsJsonObject()); }; } } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public TypeAdapter create(Gson gson, TypeToken type) { if (!ArticlesPropertyInner1.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'ArticlesPropertyInner1' and its subtypes } final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(ArticlesPropertyInner1.class)); return (TypeAdapter) new TypeAdapter() { @Override public void write(JsonWriter out, ArticlesPropertyInner1 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 ArticlesPropertyInner1 read(JsonReader in) throws IOException { JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); validateJsonObject(jsonObj); // store additional fields in the deserialized instance ArticlesPropertyInner1 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 ArticlesPropertyInner1 given an JSON string * * @param jsonString JSON string * @return An instance of ArticlesPropertyInner1 * @throws IOException if the JSON string is invalid with respect to ArticlesPropertyInner1 */ public static ArticlesPropertyInner1 fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, ArticlesPropertyInner1.class); } /** * Convert an instance of ArticlesPropertyInner1 to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy