Gutting an Interface to Create a Class



VisualAge for Java provides some excellent tools for JavaBean component creation and maintenance. However, it is often important to create interfaces to abstract a bean, especially for use in design patterns such as Model-View-Controller (MVC).

In a normal MVC development cycle, you first create your interfaces, then implement them as concrete models. Conceptually, this is the right way to go. However, this can involve a lot of typing. Often, the model interface provides standard bound properties and custom event registration capabilities.

VisualAge for Java's BeanInfo editor creates JavaBean properties and events quite easily. We can leverage this by creating a concrete model first, then gutting it to create an interface.

AutoGut examines an existing class and creates an interface for all of its public methods. This provides a good initial interface that you can use for your model. You may need to do a bit of tweaking (AutoGut currently does not copy import statements, for example), but this is much simpler than writing the interface by hand.


I have just packaged autogut as a tool for VisualAge for Java 3.0. It will probably work in version 2.0 but I have not tested it there.Tools

Installation for VisualAge for Java - Tool Packaging

To use AutoGut in VisualAge for Java:

  1. Download from this site.
  2. Unzip to the directory where VisualAge for Java is installed.  For example, C:\IBMVJava.
  3. Shutdown VisualAge for Java if it is running
  4. Start VisualAge for Java.

This will add the autogut tool to the Workspace->Tools menu, as well as the Tools menu for classes.

Source Code

If you're interested in the source code for this tool, you can download Note that you do not need the source code to use the tool. This is a zipped VisualAge for Java repository file. You will need to unzip this file and import the JavaDude AutoGut project from this repository.


VisualAge for Java

To use AutoGut (once it is installed)


Currently the tool does not copy the import statements from the class. You may need to add them yourself.

The tool is not completely bulletproof yet, though it's in pretty good shape. Just be careful what you type.


AutoGut free for any use other than selling it as a stand-alone product.

Note that AutoGut is provided "as-is" without any warrantee or guarantee of suitability for any purpose. Scott Stanchfield cannot be held responsible for any damage caused by its use.

(In other words, use 'em for free at your own risk.)