Interface Embed.Fields
- Enclosing class:
Embed
public static interface Embed.Fields
Methods for manipulating the fields of an
Embed
.-
Method Summary
Modifier and TypeMethodDescriptiondefault Embed.Fields
add
(boolean inline) Adds a blank (empty) Field to the embed.default Embed.Fields
Adds a Field to the embed that isn't inlined.Adds a Field to the embed.default Embed.Fields
add
(@Nullable MessageEmbed.Field field) Copies the provided Field into a new Field for this builder.default Embed.Fields
clear()
Clears all fields from the embed.default Embed.Fields
Removes all fields with the given value.default Embed.Fields
Removes all fields with the given name and value.default Embed.Fields
removeByName
(String name) Removes all fields with the given name.default Embed.Fields
removeIf
(String name, Predicate<MessageEmbed.Field> filter) Removes all fields with the given name of this embed based on the givenPredicate
.removeIf
(Predicate<MessageEmbed.Field> filter) Removes all fields of this embed based on the givenPredicate
.default Embed.Fields
replace
(String name, MessageEmbed.Field field) Replaces all fields of this embed with the givenMessageEmbed.Field
based on the given name.replace
(Predicate<MessageEmbed.Field> filter, MessageEmbed.Field field) Replaces all fields of this embed based on thePredicate
with the givenMessageEmbed.Field
.default Embed.Fields
replaceByValue
(String value, MessageEmbed.Field field) Replaces all fields of this embed with the givenMessageEmbed.Field
based on the given value.
-
Method Details
-
add
Adds a Field to the embed that isn't inlined.- Parameters:
name
- the name of the Field, displayed in bold above the value.value
- the contents of the field.- Returns:
- this instance for fluent interface
-
add
Copies the provided Field into a new Field for this builder.
For additional documentation, see
add(String,String,boolean)
- Parameters:
field
- the field object to add- Returns:
- the builder after the field has been added
-
add
Adds a blank (empty) Field to the embed.
- Parameters:
inline
- whether this field should display inline- Returns:
- the builder after the field has been added
-
add
Adds a Field to the embed.
Note: If a blank string is provided to either
name
orvalue
, the blank string is replaced withEmbedBuilder.ZERO_WIDTH_SPACE
.- Parameters:
name
- the name of the Field, displayed in bold above thevalue
.value
- the contents of the field.inline
- whether this field should display inline.- Returns:
- the builder after the field has been added
- Throws:
IllegalArgumentException
-
-
removeIf
-
remove
Removes all fields with the given value.- Parameters:
value
- the value of a field that should be removed- Returns:
- this instance for fluent interface
-
removeByName
Removes all fields with the given name.- Parameters:
name
- the name of a field that should be removed- Returns:
- this instance for fluent interface
-
remove
Removes all fields with the given name and value.- Parameters:
name
- the name of the field that should be removedvalue
- the value of the field that should be removed- Returns:
- this instance for fluent interface
-
clear
Clears all fields from the embed.- Returns:
- this instance for fluent interface
-
removeIf
-
replace
Replaces all fields of this embed with the givenMessageEmbed.Field
based on the given name.- Parameters:
name
- the name of a field that should be replacedfield
- the newMessageEmbed.Field
to replace the old value with- Returns:
- this instance for fluent interface
-
replaceByValue
Replaces all fields of this embed with the givenMessageEmbed.Field
based on the given value.- Parameters:
value
- the value of a field that should be replacedfield
- the newMessageEmbed.Field
to replace the old value with- Returns:
- this instance for fluent interface
-
replace
Replaces all fields of this embed based on thePredicate
with the givenMessageEmbed.Field
.- Parameters:
filter
- thePredicate
to test the fields withfield
- the newMessageEmbed.Field
to replace the old values with- Returns:
- this instance for fluent interface
-