Package com.courier.models
Class Discord
-
- All Implemented Interfaces:
public final class Discord
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceDiscord.VisitorAn interface that defines how to map each variant of Discord to a value of type T.
-
Method Summary
Modifier and Type Method Description final Optional<SendToChannel>sendToChannel()final Optional<SendDirectMessage>sendDirectMessage()final BooleanisSendToChannel()final BooleanisSendDirectMessage()final SendToChannelasSendToChannel()final SendDirectMessageasSendDirectMessage()final Optional<JsonValue>_json()final <T extends Any> Taccept(Discord.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final Discordvalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static DiscordofSendToChannel(SendToChannel sendToChannel)final static DiscordofSendDirectMessage(SendDirectMessage sendDirectMessage)-
-
Method Detail
-
sendToChannel
final Optional<SendToChannel> sendToChannel()
-
sendDirectMessage
final Optional<SendDirectMessage> sendDirectMessage()
-
isSendToChannel
final Boolean isSendToChannel()
-
isSendDirectMessage
final Boolean isSendDirectMessage()
-
asSendToChannel
final SendToChannel asSendToChannel()
-
asSendDirectMessage
final SendDirectMessage asSendDirectMessage()
-
accept
final <T extends Any> T accept(Discord.Visitor<T> visitor)
Maps this instance's current variant to a value of type T using the given visitor.
Note that this method is not forwards compatible with new variants from the API, unless visitor overrides Visitor.unknown. To handle variants not known to this version of the SDK gracefully, consider overriding Visitor.unknown:
import com.courier.core.JsonValue; import java.util.Optional; Optional<String> result = discord.accept(new Discord.Visitor<Optional<String>>() { @Override public Optional<String> visitSendToChannel(SendToChannel sendToChannel) { return Optional.of(sendToChannel.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final Discord validate()
Validates that the types of all values in this object match their expected types recursively.
This method is not forwards compatible with new types from the API for existing fields.
-
ofSendToChannel
final static Discord ofSendToChannel(SendToChannel sendToChannel)
-
ofSendDirectMessage
final static Discord ofSendDirectMessage(SendDirectMessage sendDirectMessage)
-
-
-
-