Package net.ygbstudio.powerwp4j.builders
Class WPPayloadNodeBuilder
java.lang.Object
net.ygbstudio.powerwp4j.base.extension.builders.AbstractPayloadNodeBuilder<WPPayloadNodeBuilder>
net.ygbstudio.powerwp4j.builders.WPPayloadNodeBuilder
This class is a specialized builder for constructing JSON payloads in the format used by the
WordPress REST API. It provides a fluent interface for creating JSON payloads by adding
properties to the internal
ObjectNode.
This class is parameterized with the type of the concrete subclass. This allows subclasses to define their own type while still being able to use the common functionality provided by this class.
This class is an extension of AbstractPayloadNodeBuilder and provides additional
methods for setting properties specific to the WordPress REST API.
-
Field Summary
Fields inherited from class net.ygbstudio.powerwp4j.base.extension.builders.AbstractPayloadNodeBuilder
payloadNode -
Method Summary
Modifier and TypeMethodDescriptionauthor(int authorInt) Sets the author.static @NotNull WPPayloadNodeBuilderbuilder()Returns a new instance of the payload node builder.<T extends Number>
WPPayloadNodeBuildercategories(@NotNull List<T> categories) Sets the categories.<T,U extends Number>
WPPayloadNodeBuildercategories(@NotNull Set<WPClassMapping<T, U>> categoriesMappingSet) Sets the categories using a set ofWPClassMappingobjects.commentStatus(CommentStatusEnum status) Sets the comment status.Sets the content.description(String description) Sets the description.Sets the excerpt.featuredMedia(int featuredMediaId) Sets the featured media.format(PostFormatEnum format) Sets the post format.Sets the slug.status(PostStatusEnum status) Sets the post status.sticky(boolean sticky) Sets the sticky flag.<T extends Number>
WPPayloadNodeBuilderSets the tags.<T,U extends Number>
WPPayloadNodeBuildertags(@NotNull Set<WPClassMapping<T, U>> tagsMappingSet) Sets the tags using a set ofWPClassMappingobjects.Sets the title.type(PostTypeEnum type) Sets the post type.
-
Method Details
-
builder
Returns a new instance of the payload node builder.- Returns:
- a new instance of the payload node builder
-
author
Sets the author.- Parameters:
authorInt- the author to set- Returns:
- the payload node builder
-
status
Sets the post status.- Parameters:
status- the post status to set- Returns:
- the payload node builder
-
type
Sets the post type.- Parameters:
type- the post type to set- Returns:
- the payload node builder
-
format
Sets the post format.- Parameters:
format- the post format to set- Returns:
- the payload node builder
-
commentStatus
Sets the comment status.- Parameters:
status- the comment status to set- Returns:
- the payload node builder
-
categories
Sets the categories.- Type Parameters:
T- the numeric type of the categories- Parameters:
categories- the categories to set- Returns:
- the payload node builder
-
tags
Sets the tags.- Type Parameters:
T- the numeric type of the tags- Parameters:
tags- the tags to set- Returns:
- the payload node builder
-
categories
public <T,U extends Number> WPPayloadNodeBuilder categories(@NotNull @NotNull Set<WPClassMapping<T, U>> categoriesMappingSet) Sets the categories using a set ofWPClassMappingobjects.- Type Parameters:
T- the type of the key in each class mapping objectU- the numeric type of the category values in theWPClassMappingobjects- Parameters:
categoriesMappingSet- the set ofWPClassMappingobjects representing the categories- Returns:
- the payload node builder
-
tags
public <T,U extends Number> WPPayloadNodeBuilder tags(@NotNull @NotNull Set<WPClassMapping<T, U>> tagsMappingSet) Sets the tags using a set ofWPClassMappingobjects.- Type Parameters:
T- the type of the key in each class mapping objectU- the numeric type of the tag values in theWPClassMappingobjects- Parameters:
tagsMappingSet- the set ofWPClassMappingobjects representing the tags- Returns:
- the payload node builder
-
slug
Sets the slug.- Parameters:
slug- the slug to set- Returns:
- the payload node builder
-
description
Sets the description.- Parameters:
description- the description to set- Returns:
- the payload node builder
-
title
Sets the title.- Parameters:
title- the title to set- Returns:
- the payload node builder
-
content
Sets the content.- Parameters:
content- the content to set- Returns:
- the payload node builder
-
excerpt
Sets the excerpt.- Parameters:
excerpt- the excerpt to set- Returns:
- the payload node builder
-
sticky
Sets the sticky flag.- Parameters:
sticky- the sticky flag to set- Returns:
- the payload node builder
-
featuredMedia
Sets the featured media.- Parameters:
featuredMediaId- the featured media to set- Returns:
- the payload node builder
-