Skip to content

Commit

Permalink
Clarify @WithDefaults documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
radcortez committed Sep 16, 2024
1 parent 4885a0e commit a756c53
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions documentation/src/main/docs/config/mappings.md
Original file line number Diff line number Diff line change
Expand Up @@ -533,10 +533,13 @@ public interface Server {
server.aliases.prod.name=prod
```

A look up to the `aliases` `Map` with the key `localhost`, `any` or any other key, returns a `Alias` instance, where
`Alias.name` is `localhost`, because that is the default value. A look up to `prod` returns a `Alias` instance, where
A look-up to the `aliases` `Map` with the key `localhost`, `any` or any other key, returns a `Alias` instance, where
`Alias.name` is `localhost`, which is the default value. A look-up to `prod` returns a `Alias` instance, where
`Alias.name` is `prod` because the property is defined in the configuration as `server.aliases.prod.name=prod`.

The `Map` can only iterate and size the defined keys. In this case, the `aliases` `Map` only iterates the `prod` key,
and the size is `1`.

```java
Server server = config.getConfigMapping(Server.class);
Map<String, Alias> localhost = server.aliases.get("localhost");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import java.lang.annotation.Target;

/**
* Marker annotation intented to be used only in a <code>Map</code> mapping to allow the <code>Map</code> to return
* the default value for the value element on any key lookup.
* Marker annotation to be used only in a <code>Map</code> mapping to allow the <code>Map</code> to return the default
* value for the value element on any key lookup.
*/
@Documented
@Retention(RetentionPolicy.RUNTIME)
Expand Down

0 comments on commit a756c53

Please sign in to comment.