Skip to content

Commit

Permalink
#205 API Change: CommandLine::getCommand now returns a generic type…
Browse files Browse the repository at this point in the history
… instead of Object so client code can avoid type casting.

Closes #205.
  • Loading branch information
remkop committed Oct 15, 2017
1 parent 117e3b3 commit cc93929
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ The following are the features that have been promoted in this picocli release.

- #179 API Change to remove full JRE dependency and require only Compact Profile. Replace use of `java.awt.Point` with `picocli.CommandLine.Help.TextTable.Cell`. Thanks to [webfolderio](https://github.com/webfolderio).
- #196 API Change: `Option::type()` and `Parameters::type()` now return empty array by default (was `{String.class}`).
- #205 API Change: `CommandLine::getCommand` now returns a generic type instead of Object so client code can avoid type casting.
- #130 New feature: Options and positional parameters can now be mixed on the command line.
- #196 New feature: Infer type from collections and maps when `type` annotation not specified. Thanks to [ddimtirov](https://github.com/ddimtirov) for the suggestion.
- #197 New feature: Use `type` attribute to determine conversion target type instead of field type. This allows fields to be declared as interfaces or abstract types (or arrays/collections/maps of these) and via the `type` attribute picocli will be able to convert String arguments to concrete implementation objects.
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/picocli/CommandLine.java
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,8 @@ public CommandLine getParent() {
* @return the annotated object that this {@code CommandLine} instance was constructed with
* @since 0.9.7
*/
public Object getCommand() {
return interpreter.command;
public <T> T getCommand() {
return (T) interpreter.command;
}

/** Returns {@code true} if an option annotated with {@link Option#usageHelp()} was specified on the command line.
Expand Down

0 comments on commit cc93929

Please sign in to comment.