Record Class Embeds

java.lang.Object
java.lang.Record
io.github.kaktushose.jdac.embeds.internal.Embeds
Record Components:
sources - the EmbedDataSources Embeds can be loaded from
placeholders - the global placeholders as defined in EmbedConfig.placeholders(Map)

@Internal public record Embeds(Collection<EmbedDataSource> sources, Map<String,Object> placeholders, MessageResolver messageResolver) extends Record
Container for immutably holding the embed configuration made by EmbedConfig.
  • Constructor Details

    • Embeds

      public Embeds(Collection<EmbedDataSource> sources, Map<String,Object> placeholders, MessageResolver messageResolver)
      Creates an instance of a Embeds record class.
      Parameters:
      sources - the value for the sources record component
      placeholders - the value for the placeholders record component
      messageResolver - the value for the messageResolver record component
  • Method Details

    • get

      public Embed get(String name)
      Gets an Embed based on the given name.
      Parameters:
      name - the name of the Embed
      Returns:
      the Embed
      Throws:
      IllegalArgumentException - if no Embed with the given name exists in the configured data sources
    • get

      public Embed get(String name, Locale locale)
      Gets an Embed based on the given name and sets the Locale.
      Parameters:
      name - the name of the Embed
      locale - the Locale to use for localization
      Returns:
      the Embed
      Throws:
      IllegalArgumentException - if no Embed with the given name exists in the configured data sources
    • exists

      public boolean exists(String name)
      Checks whether an Embed with the given name exists in one of the sources().
      Parameters:
      name - the name of the Embed
      Returns:
      true if the embed exists
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • sources

      public Collection<EmbedDataSource> sources()
      Returns the value of the sources record component.
      Returns:
      the value of the sources record component
    • placeholders

      public Map<String,Object> placeholders()
      Returns the value of the placeholders record component.
      Returns:
      the value of the placeholders record component
    • messageResolver

      public MessageResolver messageResolver()
      Returns the value of the messageResolver record component.
      Returns:
      the value of the messageResolver record component