geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gdam...@apache.org
Subject cvs commit: incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/gbean/jmx CGLibMethodInterceptor.java
Date Wed, 14 Jul 2004 00:34:48 GMT
gdamour     2004/07/13 17:34:48

  Modified:    modules/kernel/src/java/org/apache/geronimo/gbean/jmx
                        CGLibMethodInterceptor.java
  Log:
  When creating the RawGBeanInvokers for potential attributes, the process is now the following
one:
  - firstly uses the name directly embedded in the method name;
  - if the previous attempt fails, then decapitalizes the name and try the result.
  
  For instance, for a method "getFoo", the implementation looks for the attribute "Foo". If
such an attribute
  does not exist, it then looks for the attribute "foo".
  
  JMXGBeanInvoker only tries the name directly embedded in the method name in order to be
compliant
  with the JMX standards.
  
  Revision  Changes    Path
  1.4       +19 -13    incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/gbean/jmx/CGLibMethodInterceptor.java
  
  Index: CGLibMethodInterceptor.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/gbean/jmx/CGLibMethodInterceptor.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- CGLibMethodInterceptor.java	12 Jul 2004 06:07:51 -0000	1.3
  +++ CGLibMethodInterceptor.java	14 Jul 2004 00:34:47 -0000	1.4
  @@ -160,29 +160,41 @@
   
           if (method.getName().startsWith("get")) {
               String attributeName = method.getName().substring(3);
  -            attributeName = Introspector.decapitalize(attributeName);
               Integer methodIndex = ((Integer) attributes.get(attributeName));
               if (methodIndex != null) {
                   return new RawGetAttributeInvoker(rawInvoker, methodIndex.intValue());
               }
  +            attributeName = Introspector.decapitalize(attributeName);
  +            methodIndex = ((Integer) attributes.get(attributeName));
  +            if (methodIndex != null) {
  +                return new RawGetAttributeInvoker(rawInvoker, methodIndex.intValue());
  +            }
           }
   
           if (method.getName().startsWith("is")) {
               String attributeName = method.getName().substring(2);
  -            attributeName = Introspector.decapitalize(attributeName);
               Integer methodIndex = ((Integer) attributes.get(attributeName));
               if (methodIndex != null) {
                   return new RawGetAttributeInvoker(rawInvoker, methodIndex.intValue());
               }
  +            attributeName = Introspector.decapitalize(attributeName);
  +            methodIndex = ((Integer) attributes.get(attributeName));
  +            if (methodIndex != null) {
  +                return new RawGetAttributeInvoker(rawInvoker, methodIndex.intValue());
  +            }
           }
   
           if (method.getName().startsWith("set")) {
               String attributeName = method.getName().substring(3);
  -            attributeName = Introspector.decapitalize(attributeName);
               Integer methodIndex = ((Integer) attributes.get(attributeName));
               if (methodIndex != null) {
                   return new RawSetAttributeInvoker(rawInvoker, methodIndex.intValue());
               }
  +            attributeName = Introspector.decapitalize(attributeName);
  +            methodIndex = ((Integer) attributes.get(attributeName));
  +            if (methodIndex != null) {
  +                return new RawSetAttributeInvoker(rawInvoker, methodIndex.intValue());
  +            }
           }
           return null;
       }
  @@ -233,21 +245,15 @@
   
           String name = method.getName();
           if (name.startsWith("get")) {
  -            String attributeName = method.getName().substring(3);
  -            attributeName = Introspector.decapitalize(attributeName);
  -            if (attributes.containsKey(attributeName)) {
  +            if (attributes.containsKey(method.getName().substring(3))) {
                   return new JMXGetAttributeInvoker(server, method);
               }
           } else if (name.startsWith("is")) {
  -            String attributeName = method.getName().substring(2);
  -            attributeName = Introspector.decapitalize(attributeName);
  -            if (attributes.containsKey(attributeName)) {
  +            if (attributes.containsKey(method.getName().substring(2))) {
                   return new JMXGetAttributeInvoker(server, method);
               }
           } else if (name.startsWith("set")) {
  -            String attributeName = method.getName().substring(3);
  -            attributeName = Introspector.decapitalize(attributeName);
  -            if (attributes.containsKey(attributeName)) {
  +            if (attributes.containsKey(method.getName().substring(3))) {
                   return new JMXSetAttributeInvoker(server, method);
               }
           }
  
  
  

Mime
View raw message