Record Class CustomId
java.lang.Object
java.lang.Record
com.github.kaktushose.jda.commands.definitions.interactions.CustomId
- Record Components:
runtimeId
- the id of theRuntime
this custom id is bound to or the literalindependent
.definitionId
- theDefinition.definitionId()
Representation of a custom id used in modals, buttons or select menus.
- Implementation Note:
- the custom id has the following format:
jdac.runtimeId.definitionId
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription@NotNull String
Returns the value of thedefinitionId
record component.final boolean
Indicates whether some other object is "equal to" this one.static @NotNull CustomId
fromEvent
(@NotNull ModalInteractionEvent event) Constructs a newCustomId
from the givenModalInteractionEvent
.static @NotNull CustomId
fromEvent
(@NotNull GenericComponentInteractionCreateEvent event) Constructs a newCustomId
from the givenGenericInteractionCreateEvent
.final int
hashCode()
Returns a hash code value for this object.@NotNull String
id()
The String representation of this custom id.static @NotNull CustomId
independent
(@NotNull String definitionId) Constructs a new runtime-independentCustomId
from the given definition id.boolean
isBound()
Checks if the passed custom id is runtime-bound.boolean
Checks if the passed custom id is runtime-independent.static boolean
Checks if the passed custom id doesn't conform to the defined format of jda-commands.@NotNull String
Gets the runtime id of this custom id.final String
toString()
Returns a string representation of this record class.
-
Field Details
-
BOUND_CUSTOM_ID_REGEX
- See Also:
-
INDEPENDENT_CUSTOM_ID_REGEX
-
-
Constructor Details
-
CustomId
Creates an instance of aCustomId
record class.- Parameters:
runtimeId
- the value for theruntimeId
record componentdefinitionId
- the value for thedefinitionId
record component
-
-
Method Details
-
fromEvent
@NotNull public static @NotNull CustomId fromEvent(@NotNull @NotNull GenericComponentInteractionCreateEvent event) Constructs a newCustomId
from the givenGenericInteractionCreateEvent
.- Parameters:
event
- theGenericInteractionCreateEvent
- Returns:
- the
CustomId
-
fromEvent
Constructs a newCustomId
from the givenModalInteractionEvent
.- Parameters:
event
- theModalInteractionEvent
- Returns:
- the
CustomId
-
independent
-
isInvalid
Checks if the passed custom id doesn't conform to the defined format of jda-commands.- Returns:
true
if the passed custom id doesn't conform to the jda-commands format
-
id
The String representation of this custom id. -
runtimeId
Gets the runtime id of this custom id.- Returns:
- the runtime id
- Throws:
IllegalStateException
- if this custom id is runtime-independent
-
isIndependent
public boolean isIndependent()Checks if the passed custom id is runtime-independent.- Returns:
true
if the custom id is runtime-independent
-
isBound
public boolean isBound()Checks if the passed custom id is runtime-bound.- Returns:
true
if the custom id is runtime-bound
-
toString
-
hashCode
-
equals
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 withObjects::equals(Object,Object)
. -
definitionId
Returns the value of thedefinitionId
record component.- Returns:
- the value of the
definitionId
record component
-