java.lang.Object
java.lang.Record
dev.sympho.modular_commands.utils.parse.entity.EntityRef.ChannelRef<C>
- Type Parameters:
C- The channel type.- Record Components:
type- The channel type.id- The channel ID.
- All Implemented Interfaces:
EntityRef<C>
public static record EntityRef.ChannelRef<C extends @NonNull Channel>(Class<C extends @NonNull Channel> type, Snowflake id)
extends Record
implements EntityRef<C>
A reference to a channel.
- Since:
- 1.0
-
Nested Class Summary
Nested classes/interfaces inherited from interface dev.sympho.modular_commands.utils.parse.entity.EntityRef
EntityRef.ChannelRef<C extends @NonNull Channel>, EntityRef.MessageRef, EntityRef.RoleRef, EntityRef.UserRef -
Constructor Summary
ConstructorsConstructorDescriptionChannelRef(Class<C> type, Snowflake id) Creates an instance of aChannelRefrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.get(GatewayDiscordClient client) Obtains the referenced entity.final inthashCode()Returns a hash code value for this object.id()Returns the value of theidrecord component.toString()Returns a string representation of this record class.type()Returns the value of thetyperecord component.
-
Constructor Details
-
Method Details
-
get
Description copied from interface:EntityRefObtains the referenced entity.- Specified by:
getin interfaceEntityRef<C extends @NonNull Channel>- Parameters:
client- The client to use to connect to Discord.- Returns:
- The entity. May be empty if there is no entity that matches the reference, and
may fail with a
InvalidArgumentExceptionif an entity exists but there is a mismatch.
-
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. -
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. -
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). -
type
Returns the value of thetyperecord component.- Returns:
- the value of the
typerecord component
-
id
Returns the value of theidrecord component.- Returns:
- the value of the
idrecord component
-