Class EmbedDTO

java.lang.Object
com.github.kaktushose.jda.commands.embeds.EmbedDTO
All Implemented Interfaces:
Serializable

public class EmbedDTO extends Object implements Serializable
This class is a DTO to serialize and deserialize JDAs embed objects to json. Checkout the discord docs to get information about what each field does exactly.

The json object can contain {placeholders} which can then be injected with values at runtime by calling injectValue(String, Object) or injectValues(Map). Alternatively you can use injectFields(Object...) to inject the fields of objects.

See Also:
  • Constructor Details

  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getTitle

      public String getTitle()
    • setTitle

      public void setTitle(String title)
    • getDescription

      public String getDescription()
    • setDescription

      public void setDescription(String description)
    • getUrl

      public String getUrl()
    • setUrl

      public void setUrl(String url)
    • getColor

      public String getColor()
    • setColor

      public void setColor(String color)
    • getTimestamp

      public String getTimestamp()
    • setTimestamp

      public void setTimestamp(String timestamp)
    • getFooter

      public EmbedDTO.Footer getFooter()
    • setFooter

      public void setFooter(EmbedDTO.Footer footer)
    • getThumbnail

      public EmbedDTO.Thumbnail getThumbnail()
    • setThumbnail

      public void setThumbnail(EmbedDTO.Thumbnail thumbnail)
    • getImage

      public EmbedDTO.Image getImage()
    • setImage

      public void setImage(EmbedDTO.Image image)
    • getAuthor

      public EmbedDTO.Author getAuthor()
    • setAuthor

      public void setAuthor(EmbedDTO.Author author)
    • getFields

      public EmbedDTO.Field[] getFields()
    • setFields

      public void setFields(EmbedDTO.Field[] fields)
    • toEmbedBuilder

      public EmbedBuilder toEmbedBuilder()
      Transfers this object to a EmbedBuilder.
      Returns:
      the EmbedBuilder
    • toMessageEmbed

      public MessageEmbed toMessageEmbed()
      Transfers this object to a MessageEmbed.
      Returns:
      the MessageEmbed
    • toMessageCreateData

      public MessageCreateData toMessageCreateData()
      Transfers this object to a MessageCreateBuilder.
      Returns:
      the MessageCreateBuilder
    • injectFields

      public EmbedDTO injectFields(Object... objects)
      Attempts to inject {placeholders} with the values of the given object fields. Therefore, the name of the field must match the name of the {placeholder}.
      Parameters:
      objects - the objects to get the fields from
      Returns:
      the current instance to use fluent interface
    • injectValues

      public EmbedDTO injectValues(Map<String,Object> values)
      Attempts to inject {placeholders} with the given values.
      Parameters:
      values - a Map with all values to inject. Key: name of the placeholder. Value: the value to inject
      Returns:
      the current instance to use fluent interface
    • injectValue

      public EmbedDTO injectValue(String name, Object object)
      Attempts to inject a {placeholder} with the given value.
      Parameters:
      name - the name of the placeholder
      object - the value to inject
      Returns:
      the current instance to use fluent interface