List of usage examples for org.apache.http.util Args check
public static void check(boolean z, String str, Object... objArr)
From source file:net.dv8tion.jda.core.EmbedBuilder.java
/** * Sets the Description of the embed. This is where the main chunk of text for an embed is typically placed. * * <p><b><a href="http://i.imgur.com/lbchtwk.png">Example</a></b> * * @param description//from w w w. j av a 2 s. c om * the description of the embed, {@code null} to reset * * @throws java.lang.IllegalArgumentException * If the length of {@code description} is greater than {@link net.dv8tion.jda.core.entities.MessageEmbed#TEXT_MAX_LENGTH} * * @return the builder after the description has been set */ public EmbedBuilder setDescription(CharSequence description) { if (description == null || description.length() < 1) { this.description = new StringBuilder(); } else { Args.check(description.length() <= MessageEmbed.TEXT_MAX_LENGTH, "Description cannot be longer than %d characters.", MessageEmbed.TEXT_MAX_LENGTH); this.description = new StringBuilder(description); } return this; }
From source file:net.dv8tion.jda.core.EmbedBuilder.java
/** * Appends to the description of the embed. This is where the main chunk of text for an embed is typically placed. * * <p><b><a href="http://i.imgur.com/lbchtwk.png">Example</a></b> * * @param description/* www . ja v a2s . c o m*/ * the string to append to the description of the embed * * @throws java.lang.IllegalArgumentException * <ul> * <li>If the provided {@code description} String is null</li> * <li>If the length of {@code description} is greater than {@link net.dv8tion.jda.core.entities.MessageEmbed#TEXT_MAX_LENGTH}.</li> * </ul> * * @return the builder after the description has been set */ public EmbedBuilder appendDescription(CharSequence description) { Args.notNull(description, "description"); Args.check(this.description.length() + description.length() <= MessageEmbed.TEXT_MAX_LENGTH, "Description cannot be longer than %d characters.", MessageEmbed.TEXT_MAX_LENGTH); this.description.append(description); return this; }