On Thu, 3 Jan 2013 09:23:19 +0000
Robert Scholte <[email protected]> wrote:

> 
> It will be a challenge and I'm not sure if it will make the documentation 
> easier. I think that this could work:create a IncludedLicenses object with a 
> String constructor and a getter/setter for the list. I don't think that using 
> setters in the mojo will work. I expect Plexus to search for the setter bound 
> to the type of the parameter. Let me know if one of these options worked. 
> Maybe worth writing somewhere. Robert

Ok I have hack something in license-m-p (see 
https://fisheye.codehaus.org/changelog/mojo?cs=17833)

I create a Class for each such parameter.

Plexus found my type, so will use a setterField convertor, 

for the simple string to split, I need to had a setter in the mojo (will then 
use the constructor of my object to split data).

for the list case, will use a *setter* of my object to in fact add a new entry 
in the list.

IMHO, it would be a lot more clean to create a plexus converter, but I did not 
find any clue for how to custom the convertorLookup in componentconfigurator... 
Will post @ maven-dev for this.

To resume :

class MyMojo {

 private MyParamters myParameters;

 setMyParameters(String simpleStringToSplit) { myParameter = new 
StringOrList(simpleStringToSplit); }

 static class MyParamters {

    private List<String> data;
    
    MyParamters() { data = new ArrayList<String>(); }
    
    MyParamters(String simpleStringToSplit) { this(); ... split string and fill 
data }
    
    public setMyParameter(String singleDataToAdd) { ... }
 }
} 


>  > Date: Thu, 3 Jan 2013 09:57:36 +0100
> > From: [email protected]
> > To: mojo.codehaus.org [email protected]
> > Subject: [mojo-dev] Strategy to change a parameter format
> > 
> > Hy,
> > 
> > I try to resolve https://jira.codehaus.org/browse/MLICENSE-53 
> > 
> > We have actually a parameter (includedLicenses) read as a String and then 
> > split (separated by comma), seems a good idea at the time it was written...
> > 
> > But now after using it, seems better to use a list of array of String for 
> > this mojo parameter.
> > 
> > Is there a strategy to change this configuration without breaking old-style 
> > configuration ? I can't find a nice solution 
> > (other than adding a new parameter includedLicensesList for example).
> > 
> > If anyone has already done something like this, or have a great idea, 
> > please help :)
> > 
> > BTW Happy new Year to codehauser :)
> > 
> > thanks,
> > 
> > tony.
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe from this list, please visit:
> > 
> >     http://xircles.codehaus.org/manage_email
> > 
> > 
>                                         


-- 
Tony Chemit
--------------------
tél: +33 (0) 2 40 50 29 28
email: [email protected]
http://www.codelutin.com

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to