Dave Yost
3/25/98
Generates a new Java class source file that extends a given class and/or implements given interfaces.
javaextend [ options ] NewClassName Super*
Javaextend parses the declarations and documentation comments in the Java source files for the given Super classes and interfaces and their ancestors and produces a NewClassName.java source file that extends and/or implements the given Super class and/or interfaces. The new class acts as a template for new code, implementing and overriding everything from the given superclass and/or interfaces. The generated methods and constructors end with
return?;
so they will not compile.The new source file has correct doc comments for the class and for all members, incorporating the doc comments from the superclass and interfaces where available and creating new doc comments where not available.
Javaextend inserts the flag string NEEDSWORK in each doc comment and the comment //NEEDSWORK in each method body possibly along with an appropriate call to super. The programmer can use these flag strings to identify each piece of pro forma doc comment or code that has not yet either been deleted or modified and delete the flag string when the code has been dealt with. Each
NEEDSWORK
string is followed by some additional information, for example://NEEDSWORK implements interface Name
//NEEDSWORK implements abstract Name
//NEEDSWORK overrides super NameJavaextend is related to javacomment.
You can use an argument beginning with the character '@' to specify a file containing additional arguments, one argument per line. These arguments are inserted into the command line at the position of the '@<filename>' argument.
Javaextend Options
- -abstractonly
- Normally the new class file has all the members and methods of the superclass, but with this option, only the abstract methods and constructors from the superclass and methods from the interfaces are generated.
- -author string
- Specifies the text for the @author tag.
- -flag string
- Insert string wherever javacomment creates or detects a void that the programmer must fill with descriptive text. Default is "NEEDSWORK".
- -nosince
- Don't include the @since tag.
- -publiconly
- Insert doc comments only for the class and the public methods.
- -since string
- Insert string after every @since tag. Default is "".
- -sourcepath string
- Look for source files in the given path.
javaextend -nosince -author "Dave Yost" MyIterator java.util.Iterator
import java.util.Iterator; /** NEEDSWORK * An iterator over a Collection. Iterator takes the place of Enumeration in * the Java collection framework. Iterators differ from Enumerations in two * ways: <ul> <li> Iterators allow the caller to remove elements from the * underlying collection during the iteration with well-defined * semantics. <li>Method names have been improved.</ul> * * @author Dave Yost */ public class MyIterator extends Iterator { /** NEEDSWORK * @return true if the iteration has more elements. * */ public boolean hasNext() { return?; //NEEDSWORK implements interface Iterator } /** NEEDSWORK * Returns the next element in the interation. * * @exception NoSuchElementException iteration has no more elements. */ public Object next() { return?; //NEEDSWORK implements interface Iterator } /** NEEDSWORK * Removes from the underlying Collection the last element returned by the * Iterator . This method can be called only once per call to next The * behavior of an Iterator is unspecified if the underlying Collection is * modified while the iteration is in progress in any way other than by * calling this method. Optional operation. * * @exception UnsupportedOperationException remove is not supported * by this Iterator. * @exception NoSuchElementException next has not yet been called, * or remove has already been called after the last call * to next. */ public void remove() { return?; //NEEDSWORK implements interface Iterator } }