Code Comments
Programming Forum and web based access to our favorite programming groups.hi there,
whats wrong with this code?
thx
import org.apache.commons.beanutils.PropertyUtils;
import java.util.Map;
public class Hello {
public static void main(String[] args) throws Exception {
Map map = PropertyUtils.describe(new A("a"));
}
}
class A {
private String name;
public A(String name) {
this.name = name;
}
public A() {
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
java.lang.NoSuchMethodException: Property 'name' has no getter method
at
org.apache.commons.beanutils.PropertyUtils.getSimpleProperty(PropertyUtils.j
ava:1180)
at
org.apache.commons.beanutils.PropertyUtils.getNestedProperty(PropertyUtils.j
ava:772)
at
org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.java:80
1)
at
org.apache.commons.beanutils.PropertyUtils.describe(PropertyUtils.java:368)
at Hello.main(Hello.java:7)
Exception in thread "main" Process terminated with exit code 1
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.