Skip to content

Commit

Permalink
api: Favor withState over as
Browse files Browse the repository at this point in the history
  • Loading branch information
zml2008 committed Dec 11, 2021
1 parent 505a4b6 commit fe8203b
Showing 1 changed file with 19 additions and 4 deletions.
Expand Up @@ -86,9 +86,11 @@ public enum TextDecoration implements StyleBuilderApplicable, TextFormat {
* @param state the state
* @return a {@link TextDecorationAndState}
* @since 4.8.0
* @deprecated for removal since 4.10.0, use {@link #withState(boolean)} instead
*/
@Deprecated
public final @NotNull TextDecorationAndState as(final boolean state) {
return this.as(State.byBoolean(state));
return this.withState(state);
}

/**
Expand All @@ -97,9 +99,11 @@ public enum TextDecoration implements StyleBuilderApplicable, TextFormat {
* @param state the state
* @return a {@link TextDecorationAndState}
* @since 4.8.0
* @deprecated for removal since 4.10.0, use {@link #withState(State)} instead
*/
@Deprecated
public final @NotNull TextDecorationAndState as(final @NotNull State state) {
return new TextDecorationAndStateImpl(this, state);
return this.withState(state);
}

/**
Expand All @@ -110,7 +114,7 @@ public enum TextDecoration implements StyleBuilderApplicable, TextFormat {
* @since 4.10.0
*/
public final @NotNull TextDecorationAndState withState(final boolean state) {
return this.as(State.byBoolean(state));
return new TextDecorationAndStateImpl(this, State.byBoolean(state));
}

/**
Expand All @@ -121,7 +125,18 @@ public enum TextDecoration implements StyleBuilderApplicable, TextFormat {
* @since 4.10.0
*/
public final @NotNull TextDecorationAndState withState(final @NotNull State state) {
return this.as(state);
return new TextDecorationAndStateImpl(this, state);
}

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

@Override
Expand Down

0 comments on commit fe8203b

Please sign in to comment.