[jboss-jira] [JBoss JIRA] Commented: (JGRP-723) Use Java annotations to automatically set protocol properties

Bela Ban (JIRA) jira-events at lists.jboss.org
Thu Apr 24 11:49:12 EDT 2008


    [ http://jira.jboss.com/jira/browse/JGRP-723?page=comments#action_12410536 ] 
            
Bela Ban commented on JGRP-723:
-------------------------------

Okay, here's what Vladimir and I discussed:

@Property
long timeout=5000;

This means we'll take a property "timeout" (parsed from the XML) and set a field called 'property' in the given protocol.

@Property
void setMaxBundleTimeout(String val) {...}

This means we'll invoke this setter with a property that's either called "max_bundle_timeout" or "maxBundleTimeout".

Logic:
#1 Get all methods which take a string argument and are annotated with @Property (include superclasses, up to Protocol).
#2 Invoke any setter M (void setM(String)) with the corresponding property. Remove the property if successful
#3 Find all attrs annotated with @Property
#4 Set the field from the property, convert the string to the primitive type
#5 If the field is not a primitive type, and there wasn't a setter, throw an exception
#6 Remove the prop from the props list. If  done, and list is not empty, throw an exception

Add @Deprecated(msg="bla"). If a setter or attr is annotated with @Deprecated, display the message and remove the property.

For validation or other complex logic, always use a setter, Ditto for non-rpimitive fields

> Use Java annotations to automatically set protocol properties
> -------------------------------------------------------------
>
>                 Key: JGRP-723
>                 URL: http://jira.jboss.com/jira/browse/JGRP-723
>             Project: JGroups
>          Issue Type: Feature Request
>    Affects Versions: 2.7
>            Reporter: Vladimir Blagojevic
>         Assigned To: Vladimir Blagojevic
>             Fix For: 2.7
>
>
> Currently we use a lot of boiler plate code to read protocol properties specified in configuration file. We can eliminate this unnecessary code by using annotations and a bit of Java reflection that would assign protocol property values to matching Java fields, give warnings for deprecated properties, and so on. We should:
> 1) introduce @ProtocolProperty annotation 
> 2) annotate Protocol fields that are properties 
> 3) test framework
> 4) remove all current boilerplate code

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list