Skip to content

Commit

Permalink
Javadoc clarifications, remove unneeded asComponent call
Browse files Browse the repository at this point in the history
  • Loading branch information
kezz committed Apr 27, 2021
1 parent b4f96bb commit dc1994e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 17 deletions.
4 changes: 2 additions & 2 deletions api/src/main/java/net/kyori/adventure/text/Component.java
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public interface Component extends ComponentBuilderApplicable, ComponentLike, Ex
@Deprecated
@Contract(value = "_, _ -> new", pure = true)
static @NonNull TextComponent join(final @NonNull ComponentLike separator, final @NonNull ComponentLike@NonNull... components) {
return join(JoinConfiguration.separator(separator.asComponent()), components);
return join(JoinConfiguration.separator(separator), components);
}

/**
Expand All @@ -150,7 +150,7 @@ public interface Component extends ComponentBuilderApplicable, ComponentLike, Ex
@Deprecated
@Contract(value = "_, _ -> new", pure = true)
static @NonNull TextComponent join(final @NonNull ComponentLike separator, final Iterable<? extends ComponentLike> components) {
return join(JoinConfiguration.separator(separator.asComponent()), components);
return join(JoinConfiguration.separator(separator), components);
}

/**
Expand Down
34 changes: 19 additions & 15 deletions api/src/main/java/net/kyori/adventure/text/JoinConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,25 @@
import org.jetbrains.annotations.NotNull;

/**
* The configuration for how a series of components can be joined.
* A configuration for how a series of components can be joined.
*
* <p>A join configuration consists of the following parts, each of which is optional:</p>
* <p>A join configuration consists of the following parts:</p>
* <dl>
* <dt>a prefix to be prepended to the resulting component</dt>
* <dt>a separator to be placed between each component</dt>
* <dt>a final separator to be placed between the last two components</dt>
* <dt>a suffix to be appended to the resulting component</dt>
* <dt>a prefix (optional)</dt>
* <dd>a component to be prepended to the resulting component</dd>
* <dt>a separator (optional)</dt>
* <dd>a component to be placed between each component</dd>
* <dt>a last separator (optiona)</dt>
* <dd>a component to be placed between the last two components</dd>
* <dt>a suffix (optional)</dt>
* <dd>a component to be appended to the resulting component</dd>
* <dt>an operator (non-optional)</dt>
* <dd>a unary operator to change each component that is being joined, defaults to the identity operator</dd>
* </dl>
*
* <p>In addition, a join configuration contains a unary operator to change each component to be joined.
* This defaults to an identity operator.</p>
*
* <p>Note that if the final separator is omitted, the normal separator will be used instead.
* To omit the final separator, but still include normal separators, use {@link Component#empty()}.</p>
* <p>Note that the last separator only acts as an override for the normal separator.
* This means that if you do not specify a last separator, the normal separator will be placed between the last two components.
* To omit the final separator, but still include normal separators, use {@link Component#empty()} as the last separator.</p>
*
* @see Component#join(JoinConfiguration, Iterable)
* @see Component#join(JoinConfiguration, ComponentLike...)
Expand All @@ -64,9 +68,9 @@ public interface JoinConfiguration extends Buildable<JoinConfiguration, JoinConf
}

/**
* Gets a join configuration with no separators and no prefix or suffix.
* Gets a join configuration with no separators, prefix or suffix.
*
* @return the join config
* @return the join configuration
* @since 4.8.0
*/
static @NonNull JoinConfiguration noSeparators() {
Expand All @@ -77,7 +81,7 @@ public interface JoinConfiguration extends Buildable<JoinConfiguration, JoinConf
* Creates a join configuration with a separator and no prefix or suffix.
*
* @param separator the separator
* @return the join config
* @return the join configuration
* @since 4.8.0
*/
static @NonNull JoinConfiguration separator(final @Nullable ComponentLike separator) {
Expand All @@ -90,7 +94,7 @@ public interface JoinConfiguration extends Buildable<JoinConfiguration, JoinConf
*
* @param separator the separator
* @param lastSeparator the last separator
* @return the join config
* @return the join configuration
* @since 4.8.0
*/
static @NonNull JoinConfiguration separators(final @Nullable ComponentLike separator, final @Nullable ComponentLike lastSeparator) {
Expand Down

0 comments on commit dc1994e

Please sign in to comment.