Class AbstractMediaPayloadBuilder<T extends AbstractMediaPayloadBuilder<T>>

java.lang.Object
net.ygbstudio.powerwp4j.base.extension.builders.AbstractMediaPayloadBuilder<T>
Type Parameters:
T - the concrete media payload builder subtype
Direct Known Subclasses:
WPMediaPayloadBuilder

public abstract class AbstractMediaPayloadBuilder<T extends AbstractMediaPayloadBuilder<T>> extends Object
Abstract builder for media attachment payloads.
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected String
    Alternative text for the media attachment.
    protected String
    Caption for the media attachment.
    protected String
    Description for the media attachment.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Creates an empty media payload builder base.
  • Method Summary

    Modifier and Type
    Method
    Description
    altText(String altText)
    Sets the alternative text for the media attachment.
    abstract tools.jackson.databind.JsonNode
    Builds the media attachment payload as a JsonNode.
    caption(String caption)
    Sets the caption for the media attachment.
    final T
    Resets all fields of the builder to their initial state.
    description(String description)
    Sets the description for the media attachment.
    protected T
    Returns the current instance of the payload builder.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • altText

      protected String altText
      Alternative text for the media attachment.
    • caption

      protected String caption
      Caption for the media attachment.
    • description

      protected String description
      Description for the media attachment.
  • Constructor Details

    • AbstractMediaPayloadBuilder

      protected AbstractMediaPayloadBuilder()
      Creates an empty media payload builder base.
  • Method Details

    • self

      protected T self()
      Returns the current instance of the payload builder. This is a protected method used for chaining method calls.

      The cast to type T is safe because the method is only called within the class hierarchy and this class is parameterized with the type of the subclass.

      Returns:
      the current instance of the payload builder
    • altText

      public T altText(String altText)
      Sets the alternative text for the media attachment.
      Parameters:
      altText - Alternative text of the media attachment.
      Returns:
      The current instance of AbstractMediaPayloadBuilder.
    • caption

      public T caption(String caption)
      Sets the caption for the media attachment.
      Parameters:
      caption - Caption of the media attachment.
      Returns:
      The current instance of AbstractMediaPayloadBuilder.
    • description

      public T description(String description)
      Sets the description for the media attachment.
      Parameters:
      description - Description of the media attachment.
      Returns:
      The current instance of AbstractMediaPayloadBuilder.
    • clear

      public final T clear()
      Resets all fields of the builder to their initial state. This method is marked as final to ensure consistent behavior across all subclasses.
      Returns:
      the current builder instance for method chaining
      See Also:
    • build

      public abstract tools.jackson.databind.JsonNode build()
      Builds the media attachment payload as a JsonNode.
      Returns:
      JsonNode representing the media attachment payload.