commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marco Benuzzi (JIRA)" <j...@apache.org>
Subject [jira] Created: (BEANUTILS-388) WrapDynaBean should handle Boolean property with is...() getter
Date Thu, 24 Feb 2011 23:06:38 GMT
WrapDynaBean should handle Boolean property with is...() getter
---------------------------------------------------------------

                 Key: BEANUTILS-388
                 URL: https://issues.apache.org/jira/browse/BEANUTILS-388
             Project: Commons BeanUtils
          Issue Type: Bug
    Affects Versions: 1.8.3
         Environment: Linux 2.6.35.11-83.fc14.i686.PAE
            Reporter: Marco Benuzzi


Stub generated from wsdl by wsimport (ant task com.sun.tools.ws.ant.WsImport) have some properties
defined with Boolean class and getter method is...() instead of get...().
Using WrapDynaBean to inspect classes which contain those Boolean give NoSuchMethodException.
Below a test code which show the problem with property "c"

In my opinion this code should work.

public class Custom {
	
	public static class Test {
		private Integer a;
		private Boolean b;
		private Boolean c;
		public Integer getA() {
			return a;
		}
		public void setA(Integer a) {
			this.a = a;
		}
		public Boolean getB() {
			return b;
		}
		public void setB(Boolean b) {
			this.b = b;
		}
		public Boolean isC() {
			return c;
		}
		public void setC(Boolean c) {
			this.c = c;
		}
		
	}
	
	public static void main(String[] args) {
		try {
			Test object = new Test();
			object.setA(100);
			object.setB(true);
			DynaBean dynaBean = new WrapDynaBean(object);
			for (DynaProperty propDesc : dynaBean.getDynaClass().getDynaProperties()) {
			    System.out.println("name = " + propDesc.getName());
			    System.out.println("class = " + propDesc.getType().getName());
			    System.out.println("value = " + dynaBean.get(propDesc.getName()));
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message