You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Slawomir Jaranowski (Jira)" <ji...@apache.org> on 2022/10/15 13:14:00 UTC
[jira] [Commented] (MPLUGIN-419) Allow @Parameter on setters methods
[ https://issues.apache.org/jira/browse/MPLUGIN-419?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17618087#comment-17618087 ]
Slawomir Jaranowski commented on MPLUGIN-419:
---------------------------------------------
New Maven api also allow it: https://github.com/apache/maven/blob/master/api/maven-api-core/src/main/java/org/apache/maven/api/plugin/annotations/Parameter.java#L45
> Allow @Parameter on setters methods
> -----------------------------------
>
> Key: MPLUGIN-419
> URL: https://issues.apache.org/jira/browse/MPLUGIN-419
> Project: Maven Plugin Tools
> Issue Type: New Feature
> Reporter: Slawomir Jaranowski
> Priority: Major
>
> We needn't filed for Mojo parameters.
> When setters method exist it is called first by Maven.
> We can declare Mojo as:
> {code:java}
> @Mojo( name = "my-mojo" )
> public class MyMojo extends AbstractMojo
> {
> @Parameter
> private String param;
> public void execute()
> {
> }
> }
> {code}
> In some case will be useful to have possibility to declare as:
> {code:java}
> @Mojo( name = "my-mojo" )
> public class MyMojo extends AbstractMojo
> {
> @Parameter
> public void setParam(String param)
> {
> // do something with param
> }
> public void execute()
> {
> }
> }
> {code}
> eg, useful:
> - normalization
> - validation
> - split one input value to more items, the same or other type
--
This message was sent by Atlassian Jira
(v8.20.10#820010)