Skip to content

Commit

Permalink
api: add TextDecoration#withState
Browse files Browse the repository at this point in the history
Fixes #431
  • Loading branch information
astei committed Oct 31, 2021
1 parent d2569b5 commit 5228cce
Showing 1 changed file with 24 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public enum TextDecoration implements StyleBuilderApplicable, TextFormat {
}

/**
* Creates a {@link TextDecorationAndState}.
* Creates a {@link TextDecorationAndState}, annotating this decoration with the given {@code state}.
*
* @param state the state
* @return a {@link TextDecorationAndState}
Expand All @@ -89,7 +89,7 @@ public enum TextDecoration implements StyleBuilderApplicable, TextFormat {
}

/**
* Creates a {@link TextDecorationAndState}.
* Creates a {@link TextDecorationAndState}, annotating this decoration with the given {@code state}.
*
* @param state the state
* @return a {@link TextDecorationAndState}
Expand All @@ -99,6 +99,28 @@ public enum TextDecoration implements StyleBuilderApplicable, TextFormat {
return new TextDecorationAndStateImpl(this, state);
}

/**
* An alias for {@link #as(boolean)}.
*
* @param state the state
* @return a {@link TextDecorationAndState}
* @since 4.8.0
*/
public final @NotNull TextDecorationAndState withState(final boolean state) {
return this.as(State.byBoolean(state));
}

/**
* An alias for {@link #as(State)}.
*
* @param state the state
* @return a {@link TextDecorationAndState}
* @since 4.8.0
*/
public final @NotNull TextDecorationAndState withState(final @NotNull State state) {
return this.as(state);
}

@Override
public void styleApply(final Style.@NotNull Builder style) {
style.decorate(this);
Expand Down

0 comments on commit 5228cce

Please sign in to comment.