Package net.dv8tion.jda.api.entities
Interface IMentionable
-
- All Superinterfaces:
java.util.Formattable,ISnowflake
- All Known Subinterfaces:
Category,Emote,GuildChannel,ListedEmote,Member,Role,SelfUser,StageChannel,StoreChannel,TextChannel,User,VoiceChannel
- All Known Implementing Classes:
Activity.Emoji,Emoji,WidgetUtil.Widget.Member
public interface IMentionable extends java.util.Formattable, ISnowflake
Marks a mentionable entity.Formattable
This interface extendsFormattableand can be used with aFormattersuch as used byString.format(String, Object...)orPrintStream.printf(String, Object...).This will use
getAsMention()rather thanObject.toString()!
Supported Features:- Width/Left-Justification
- Ensures the size of a format (Example:%20s- uses at minimum 20 chars;%-10s- uses left-justified padding) - Precision
- Cuts the content to the specified size (Example:%.20s)
More information on formatting syntax can be found in the
format syntax documentation!
Note: Some implementations also support the alternative flag.- Since:
- 3.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default voidformatTo(java.util.Formatter formatter, int flags, int width, int precision)java.lang.StringgetAsMention()Retrieve a Mention for this Entity.-
Methods inherited from interface net.dv8tion.jda.api.entities.ISnowflake
getId, getIdLong, getTimeCreated
-
-
-
-
Method Detail
-
getAsMention
@Nonnull java.lang.String getAsMention()
Retrieve a Mention for this Entity. For the publicRole(@everyone), this will return the literal string"@everyone".- Returns:
- A resolvable mention.
-
formatTo
default void formatTo(java.util.Formatter formatter, int flags, int width, int precision)- Specified by:
formatToin interfacejava.util.Formattable
-
-