You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by nt...@apache.org on 2007/04/02 16:45:20 UTC

svn commit: r524796 - /webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/utility/PropertyDescriptorPlus.java

Author: nthaker
Date: Mon Apr  2 07:45:18 2007
New Revision: 524796

URL: http://svn.apache.org/viewvc?view=rev&rev=524796
Log:
Axis2-2421

Modified:
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/utility/PropertyDescriptorPlus.java

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/utility/PropertyDescriptorPlus.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/utility/PropertyDescriptorPlus.java?view=diff&rev=524796&r1=524795&r2=524796
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/utility/PropertyDescriptorPlus.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/utility/PropertyDescriptorPlus.java Mon Apr  2 07:45:18 2007
@@ -87,8 +87,38 @@
      * @throws IllegalAccessException
      */
     public Object get(Object targetBean) throws InvocationTargetException, IllegalAccessException {
-        Method method = descriptor.getReadMethod();
-        return method.invoke(targetBean, null);
+            if(descriptor == null){
+                if(log.isDebugEnabled()){
+                    log.debug("Null Descriptor");
+                }
+                throw new RuntimeException("PropertyDescriptor not found");
+            }
+            Method method = descriptor.getReadMethod();
+            if(method == null && descriptor.getPropertyType() == Boolean.class){
+                String propertyName = descriptor.getName();
+                if(propertyName != null){
+                    String methodName = "is";
+                    methodName = methodName + ((propertyName.length()>0)?propertyName.substring(0,1).toUpperCase():"");
+                    methodName = methodName + ((propertyName.length() > 1)?propertyName.substring(1):"");
+                    if(log.isDebugEnabled()){
+                        log.debug("Method Name =" +methodName);
+                    }
+                   try{
+                       method = targetBean.getClass().getMethod(methodName, null);
+                   }catch(NoSuchMethodException e){
+                       if(log.isDebugEnabled()){
+                           log.debug("Mehtod not found" + methodName);
+                       }
+                   }
+                }
+            }
+            if(method == null){
+                if(log.isDebugEnabled()){
+                    log.debug("No read Method found to read propertyvalue");
+                }
+                throw new RuntimeException("No read Method found to read property Value from jaxbObject: "+targetBean.getClass().getName());
+            }
+            return method.invoke(targetBean, null);
     }
 
     /**



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org