Skip to content

Commit

Permalink
Added pro tip
Browse files Browse the repository at this point in the history
  • Loading branch information
Mqzn committed Sep 14, 2024
1 parent 4fb72d0 commit 4b35f37
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions docs/Imperat/command-api/Annotations Command API.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public final class BooleanValueSupplier implements OptionalValueSupplier<Boolean
return Boolean.class;
}

@Override
@Override
public <C> Boolean supply(Context<C> context) {
return false;
}
Expand All @@ -96,9 +96,16 @@ public final class BooleanValueSupplier implements OptionalValueSupplier<Boolean

Another example of how the annotation would look like on the parameter:
```java
@DefaultValue(BooleanValueSupplier.class) boolean parameter
@Default(BooleanValueSupplier.class) boolean parameter
```

:::tip[Pro%20Tip]
You can use @Default or @DefaultProvider if you want to specify an optional argument with a default value
you can add one of those `@Default` & `@DefaultProvider` without explicitly adding `@Optional`
If you want an optional argument with null as it's default value, then use `@Optional` only

:::

:::danger[CRITICAL]
Make sure that any sub-class of `OptionalValueSupplier` have an empty public constructor

Expand Down

0 comments on commit 4b35f37

Please sign in to comment.