com.afrozaar.wordpress.wpapi.v2.model.Term Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of wp-api-v2-client-java Show documentation
Show all versions of wp-api-v2-client-java Show documentation
A Java client implementation to the WordPress WP-API v2 plugin.
package com.afrozaar.wordpress.wpapi.v2.model;
import com.google.common.collect.ImmutableMap;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Map;
import java.util.Optional;
import java.util.function.BiConsumer;
public class Term {
@JsonProperty("id")
private Long id;
@JsonProperty("count")
private Integer count;
@JsonProperty("description")
private String description;
@JsonProperty("link")
private String link;
@JsonProperty("name")
private String name;
@JsonProperty("slug")
private String slug;
@JsonProperty("taxonomy")
private String taxonomySlug;
@JsonProperty("parent")
private Long parentId;
public Integer getCount() {
return count;
}
public void setCount(Integer count) {
this.count = count;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getLink() {
return link;
}
public void setLink(String link) {
this.link = link;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Long getParentId() {
return parentId;
}
public void setParentId(Long parentId) {
this.parentId = parentId;
}
public String getSlug() {
return slug;
}
public void setSlug(String slug) {
this.slug = slug;
}
public String getTaxonomySlug() {
return taxonomySlug;
}
public void setTaxonomySlug(String taxonomySlug) {
this.taxonomySlug = taxonomySlug;
}
public Map asMap() {
final ImmutableMap.Builder builder = new ImmutableMap.Builder<>();
BiConsumer c = (index, value) -> Optional.ofNullable(value).ifPresent(val -> builder.put(index, val));
c.accept("description", description);
c.accept("name", name);
c.accept("slug", slug);
c.accept("parent", parentId);
return builder.build();
}
@Override
public String toString() {
final StringBuffer sb = new StringBuffer("Term{");
sb.append("count=").append(count);
sb.append(", id=").append(id);
sb.append(", description='").append(description).append('\'');
sb.append(", link='").append(link).append('\'');
sb.append(", name='").append(name).append('\'');
sb.append(", slug='").append(slug).append('\'');
sb.append(", taxonomySlug='").append(taxonomySlug).append('\'');
sb.append(", parentId=").append(parentId);
sb.append('}');
return sb.toString();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy