Skip to content

Commit c13bc85

Browse files
author
Alexander Söderberg
committed
chore: rename & modernize descriptions
ArgumentDescription is an inaccurate name as the descriptions are used in more than just the arguments (read: components). Thus, we bring back the old "Description" name from early cloud :) The `get`-prefixes have been dropped and the JavaDoc has been updated to aling with the cloud style.
1 parent 046bcda commit c13bc85

65 files changed

Lines changed: 384 additions & 309 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

cloud-annotations/src/main/java/cloud/commandframework/annotations/ArgumentDescriptor.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
//
2424
package cloud.commandframework.annotations;
2525

26-
import cloud.commandframework.ArgumentDescription;
26+
import cloud.commandframework.Description;
2727
import cloud.commandframework.arguments.suggestion.SuggestionProvider;
2828
import java.lang.reflect.Parameter;
2929
import java.util.Objects;
@@ -39,7 +39,7 @@ public final class ArgumentDescriptor implements Descriptor {
3939
private final String parserName;
4040
private final String suggestions;
4141
private final String defaultValue;
42-
private final ArgumentDescription description;
42+
private final Description description;
4343

4444
/**
4545
* Creates a new builder.
@@ -56,7 +56,7 @@ private ArgumentDescriptor(
5656
final @Nullable String parserName,
5757
final @Nullable String suggestions,
5858
final @Nullable String defaultValue,
59-
final @Nullable ArgumentDescription description
59+
final @Nullable Description description
6060
) {
6161
this.parameter = parameter;
6262
this.name = name;
@@ -127,7 +127,7 @@ private ArgumentDescriptor(
127127
*
128128
* @return the argument description, or {@code null}
129129
*/
130-
public @Nullable ArgumentDescription description() {
130+
public @Nullable Description description() {
131131
return this.description;
132132
}
133133

@@ -161,15 +161,15 @@ public static final class Builder {
161161
private final String parserName;
162162
private final String suggestions;
163163
private final String defaultValue;
164-
private final ArgumentDescription description;
164+
private final Description description;
165165

166166
private Builder(
167167
final @Nullable Parameter parameter,
168168
final @Nullable String name,
169169
final @Nullable String parserName,
170170
final @Nullable String suggestions,
171171
final @Nullable String defaultValue,
172-
final @Nullable ArgumentDescription description
172+
final @Nullable Description description
173173
) {
174174
this.parameter = parameter;
175175
this.name = name;
@@ -260,7 +260,7 @@ private Builder() {
260260
* @param description the new description
261261
* @return the builder containing the updated description
262262
*/
263-
public @NonNull Builder description(final @Nullable ArgumentDescription description) {
263+
public @NonNull Builder description(final @Nullable Description description) {
264264
return new Builder(this.parameter, this.name, this.parserName, this.suggestions, this.defaultValue, description);
265265
}
266266

cloud-annotations/src/main/java/cloud/commandframework/annotations/ArgumentExtractorImpl.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
//
2424
package cloud.commandframework.annotations;
2525

26-
import cloud.commandframework.ArgumentDescription;
26+
import cloud.commandframework.Description;
2727
import java.lang.reflect.Method;
2828
import java.lang.reflect.Parameter;
2929
import java.util.ArrayList;
@@ -39,10 +39,10 @@
3939
*/
4040
class ArgumentExtractorImpl implements ArgumentExtractor {
4141

42-
private final Function<@NonNull Argument, @Nullable ArgumentDescription> descriptionMapper;
42+
private final Function<@NonNull Argument, @Nullable Description> descriptionMapper;
4343

4444
ArgumentExtractorImpl() {
45-
this.descriptionMapper = argument -> ArgumentDescription.of(argument.description());
45+
this.descriptionMapper = argument -> Description.of(argument.description());
4646
}
4747

4848
@Override

cloud-annotations/src/main/java/cloud/commandframework/annotations/FlagAssemblerImpl.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323
//
2424
package cloud.commandframework.annotations;
2525

26-
import cloud.commandframework.ArgumentDescription;
2726
import cloud.commandframework.CommandComponent;
2827
import cloud.commandframework.CommandManager;
28+
import cloud.commandframework.Description;
2929
import cloud.commandframework.arguments.flags.CommandFlag;
3030
import cloud.commandframework.arguments.parser.ArgumentParser;
3131
import cloud.commandframework.arguments.parser.ParserRegistry;
@@ -50,9 +50,9 @@ final class FlagAssemblerImpl implements FlagAssembler {
5050
@Override
5151
@SuppressWarnings({"unchecked", "rawtypes"})
5252
public @NonNull CommandFlag<?> assembleFlag(@NonNull final FlagDescriptor descriptor) {
53-
final ArgumentDescription description;
53+
final Description description;
5454
if (descriptor.description() == null) {
55-
description = ArgumentDescription.empty();
55+
description = Description.empty();
5656
} else {
5757
description = descriptor.description();
5858
}

cloud-annotations/src/main/java/cloud/commandframework/annotations/FlagDescriptor.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
//
2424
package cloud.commandframework.annotations;
2525

26-
import cloud.commandframework.ArgumentDescription;
26+
import cloud.commandframework.Description;
2727
import cloud.commandframework.arguments.suggestion.SuggestionProvider;
2828
import cloud.commandframework.permission.CommandPermission;
2929
import java.lang.reflect.Parameter;
@@ -45,7 +45,7 @@ public final class FlagDescriptor implements Descriptor {
4545
private final String parserName;
4646
private final String suggestions;
4747
private final CommandPermission permission;
48-
private final ArgumentDescription description;
48+
private final Description description;
4949
private final boolean repeatable;
5050

5151
/**
@@ -64,7 +64,7 @@ private FlagDescriptor(
6464
final @Nullable String parserName,
6565
final @Nullable String suggestions,
6666
final @Nullable CommandPermission permission,
67-
final @Nullable ArgumentDescription description,
67+
final @Nullable Description description,
6868
final boolean repeatable
6969
) {
7070
this.parameter = parameter;
@@ -147,7 +147,7 @@ private FlagDescriptor(
147147
*
148148
* @return the flag description, or {@code null}
149149
*/
150-
public @Nullable ArgumentDescription description() {
150+
public @Nullable Description description() {
151151
return this.description;
152152
}
153153

@@ -203,7 +203,7 @@ public static final class Builder {
203203
private final String parserName;
204204
private final String suggestions;
205205
private final CommandPermission permission;
206-
private final ArgumentDescription description;
206+
private final Description description;
207207
private final boolean repeatable;
208208

209209
private Builder(
@@ -213,7 +213,7 @@ private Builder(
213213
final @Nullable String parserName,
214214
final @Nullable String suggestions,
215215
final @Nullable CommandPermission permission,
216-
final @Nullable ArgumentDescription description,
216+
final @Nullable Description description,
217217
final boolean repeatable
218218
) {
219219
this.parameter = parameter;
@@ -365,7 +365,7 @@ private Builder() {
365365
* @param description the new description
366366
* @return the builder containing the updated description
367367
*/
368-
public @NonNull Builder description(final @Nullable ArgumentDescription description) {
368+
public @NonNull Builder description(final @Nullable Description description) {
369369
return new Builder(
370370
this.parameter,
371371
this.name,

cloud-annotations/src/main/java/cloud/commandframework/annotations/FlagExtractorImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
//
2424
package cloud.commandframework.annotations;
2525

26-
import cloud.commandframework.ArgumentDescription;
26+
import cloud.commandframework.Description;
2727
import cloud.commandframework.permission.Permission;
2828
import java.lang.reflect.Method;
2929
import java.lang.reflect.Parameter;
@@ -53,7 +53,7 @@ final class FlagExtractorImpl implements FlagExtractor {
5353
final FlagDescriptor flagDescriptor = FlagDescriptor.builder()
5454
.parameter(parameter)
5555
.name(flagName)
56-
.description(ArgumentDescription.of(this.annotationParser.processString(flag.description())))
56+
.description(Description.of(this.annotationParser.processString(flag.description())))
5757
.aliases(this.annotationParser.processStrings(Arrays.asList(flag.aliases())))
5858
.permission(Permission.of(this.annotationParser.processString(flag.permission())))
5959
.repeatable(flag.repeatable())

cloud-annotations/src/test/java/cloud/commandframework/annotations/feature/StringProcessingTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ void testStringProcessing() {
100100
final Command<TestCommandSender> command = commands.get(0);
101101
assertThat(command.toString()).isEqualTo(String.format("%s argument flags", testProperty));
102102
assertThat(command.commandPermission().toString()).isEqualTo(testProperty);
103-
assertThat(command.commandDescription().description().getDescription()).isEqualTo(testProperty);
103+
assertThat(command.commandDescription().description().textDescription()).isEqualTo(testProperty);
104104

105105
final List<CommandComponent<TestCommandSender>> components = command.components();
106106
assertThat(components).hasSize(3);

0 commit comments

Comments
 (0)