[jboss-dev-forums] [Javassist Development] - adding parameter annotations dynamically

rpslive do-not-reply at jboss.com
Thu Jun 6 16:09:35 EDT 2013


rpslive [https://community.jboss.org/people/rpslive] created the discussion

"adding parameter annotations dynamically"

To view the discussion, visit: https://community.jboss.org/message/821810#821810

--------------------------------------------------------------
how can i add parameter annotations to the parameters of a method?
*Assume the scenario*
public class A(){
       public int sum(int a,int b){
              return a+b; 
              } 
       public int totalsum(int a,int b,int c){ 
              return a+b+c; 
              } 
       } 
now the name of this class is passed to the method which will dynamically generate a new well annotated class, say dynamic(String className). The new class should appear as:
@Start
 public class newA(){
                    @MethodStart 
                    public int sum(
                                   @Param1(value="1st Parameter") 
                                   int a, 
                                   @Param2(value="2nd Parameter") 
                                   int b 
                                   ){ 
                         return a+b; 
                         } 
                      public int totalsum(
                                          @Param1(value="1st Parameter") 
                                          int a, 
                                          @Param2(value="2nd Parameter") 
                                          int b,
                                          @Param3(value="3rd Parameter") 
                                          int c 
                                          ){
                              return a+b+c; 
                              } 
adding annotation to the start of the methods and class is simple but the trickiest part is adding parameter annotations to the variable no of parameters. i found few users on net discussing a solution to this problem but it didn't seems to be working.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/821810#821810]

Start a new discussion in Javassist Development at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2063]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-dev-forums/attachments/20130606/7eb551c3/attachment.html 


More information about the jboss-dev-forums mailing list