I thought we had covered this one already? i.e. the fact it was a solid
limitation of what annotations can do.
However we may be working a bit too hard..
For most basic types (and quite a few others) we have enough information to run
our Converters
- String value provided by annotation
- Target Class provided by function parameter
This should be enough to handle things like "123", "12.3", "#FFFFFF", dates,
geometry and so on.
As for the static field idea, that can work as well however it may be good to
use the format "CLASSNAME.FIELD" so it is really obvious what is going on; and
be able to refer out to constants, enumerations and so on defined elsewhere.
--
Jody Garnett
On Monday, 13 August 2012 at 10:21 PM, Andrea Aime wrote:
> Hi,
> I was looking into ways to get the default values for process parameters in
> the annotations
> and found out that it's not possible, because an annotation parameter can only
> be a Class, primitive, String or an array of those...
> Bummer!
>
> Maybe a way to get default values anyways could be to annotate static
> constant?
>
> @DefaultValue(name="paramName")
> public static final XYZ_DEFAULT= theValue;
>
> or as an alternative, have @DescribeParameter(...
> default="theStaticFieldName").
> Neither of these would be refactoring safe.
>
> As a final alternative, go with a naming convention, if the parameter is name
> XYWZ look for
> a constant named XYWZ_DEFAULT in the process class
>
> Definitely not as nice as it would have been with a direct attribute in the
> @DescribeParameter,
> and none of them is refactoring safe, but the latter has at least the
> advantage of brevity.
>
> What do you think, worth doing?
>
> Cheers
> Andrea
>
> --
> ==
> Our support, Your Success! Visit http://opensdi.geo-solutions.it for more
> information.
> ==
>
> Ing. Andrea Aime
> @geowolf
> Technical Lead
>
> GeoSolutions S.A.S.
> Via Poggio alle Viti 1187
> 55054 Massarosa (LU)
> Italy
> phone: +39 0584 962313
> fax: +39 0584 962313
> mob: +39 339 8844549
>
> http://www.geo-solutions.it
> http://twitter.com/geosolutions_it
>
> -------------------------------------------------------
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>
> _______________________________________________
> GeoTools-Devel mailing list
> [email protected]
> (mailto:[email protected])
> https://lists.sourceforge.net/lists/listinfo/geotools-devel
>
>
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
GeoTools-Devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel