What is the best way to implement inner classes in VisualAge for Java?
[FAQ Manager's comment] If coding by hand, static and member classes are declared in the class declaration (along with import statments, static and instance variables, etc). Local classes are defined in method bodies in a method editor. As of version 3.0/3.02, VAJ does not present inner classes in the project, package, or hierarchy browsers as it does regular classes. Inner classes can't be edited on their own; you must select the containing class or method in order to edit an inner class.
Some VisualAge SmartGuides provide options to use inner classes while generating code. The CICS Enterprise Access Builder and the Visual Composition smartguide are two examples.
VAJ 3.0+ optionally generates event handling code using inner classes. You have three options while generating inner classes to handle events:
- Don't use any inner classes - Generates methods for each connection. This technique is used in VisualAge for Java Version 1 and 2 and is pretty efficient, but it creates a lot of methods in your GUI bean.
- Use one inner class - This new option is the default and is very good. It's efficient and it encapsulates the connections in one inner class.
- Use an inner class for each event. This new option is similar to the code generationin VisualAge for C++, and generates a class for each connection. This could decrease run-time performance, because instantiating classes at run time can be costly for the JVM.