Class RoleAdapter

java.lang.Object
com.github.kaktushose.jda.commands.dispatching.adapter.impl.RoleAdapter
All Implemented Interfaces:
TypeAdapter<net.dv8tion.jda.api.entities.Role>, BiFunction<String,net.dv8tion.jda.api.events.interaction.GenericInteractionCreateEvent,Optional<net.dv8tion.jda.api.entities.Role>>

public class RoleAdapter extends Object implements TypeAdapter<net.dv8tion.jda.api.entities.Role>
Type adapter for JDAs Role.
  • Constructor Details

    • RoleAdapter

      public RoleAdapter()
  • Method Details

    • apply

      @NotNull public @NotNull Optional<net.dv8tion.jda.api.entities.Role> apply(@NotNull @NotNull String raw, @NotNull @NotNull net.dv8tion.jda.api.events.interaction.GenericInteractionCreateEvent event)
      Attempts to parse a String to a Role. Accepts both the role id and name.
      Specified by:
      apply in interface BiFunction<String,net.dv8tion.jda.api.events.interaction.GenericInteractionCreateEvent,Optional<net.dv8tion.jda.api.entities.Role>>
      Specified by:
      apply in interface TypeAdapter<net.dv8tion.jda.api.entities.Role>
      Parameters:
      raw - the String to parse
      event - the GenericInteractionCreateEvent
      Returns:
      the parsed Role or an empty Optional if the parsing fails