File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problems with java.beans.*;

 
Rafael Afonso
Ranch Hand
Posts: 63
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello:
I was seeing some classes from java.beans.*package, more specificly Expression and Statement classes. This pagefrom Java Almanac shows how gets getters and setters methods using these classes.
So, I created a test class. In this class I try to use getters and setters from a Internal class, a external class but in same java file than test class and a external class in another java file.
It follows the code from test class:

Now external class code:

Well, I runned this test class and I got this:

java.lang.NoSuchMethodException: TestaStatement$InnerClass0.setValue(Integer0);
at java.beans.Statement.invoke(Statement.java:489)
at java.beans.Statement.execute(Statement.java:119)
at TestaStatement.executeSetter(TestaStatement.java:11)
at TestaStatement.testInnerClass(TestaStatement.java:26)
at TestaStatement.main(TestaStatement.java:72)
java.lang.NoSuchMethodException: <unbound>=TestaStatement$InnerClass0.getValue();
at java.beans.Statement.invoke(Statement.java:489)
at java.beans.Statement.execute(Statement.java:119)
at TestaStatement.executeGetter(TestaStatement.java:17)
at TestaStatement.testInnerClass(TestaStatement.java:32)
at TestaStatement.main(TestaStatement.java:72)
java.lang.NoSuchMethodException: OuterClass0.setValue(Integer1);
at java.beans.Statement.invoke(Statement.java:489)
at java.beans.Statement.execute(Statement.java:119)
at TestaStatement.executeSetter(TestaStatement.java:11)
at TestaStatement.testOuterClass(TestaStatement.java:42)
at TestaStatement.main(TestaStatement.java:73)
java.lang.NoSuchMethodException: <unbound>=OuterClass0.getValue();
at java.beans.Statement.invoke(Statement.java:489)
at java.beans.Statement.execute(Statement.java:119)
at TestaStatement.executeGetter(TestaStatement.java:17)
at TestaStatement.testOuterClass(TestaStatement.java:48)
at TestaStatement.main(TestaStatement.java:73)
java.lang.NoSuchMethodException: ExternClass0.setValue(Integer2);
at java.beans.Statement.invoke(Statement.java:489)
at java.beans.Statement.execute(Statement.java:119)
at TestaStatement.executeSetter(TestaStatement.java:11)
at TestaStatement.testExternClass(TestaStatement.java:58)
at TestaStatement.main(TestaStatement.java:74)
java.lang.NoSuchMethodException: <unbound>=ExternClass0.getValue();
at java.beans.Statement.invoke(Statement.java:489)
at java.beans.Statement.execute(Statement.java:119)
at TestaStatement.executeGetter(TestaStatement.java:17)
at TestaStatement.testExternClass(TestaStatement.java:64)
at TestaStatement.main(TestaStatement.java:74)

I do not understand why beans are called "TestaStatement$InnerClass0", "OuterClass0" e "ExternClass0". Where did this "0" come? Did I do something wrong in my code. What do you think?
Thanks,
 
Jason Menard
Sheriff
Posts: 6450
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm going to move this to Java in General (beginner).
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic