public abstract class JavaWriter extends Object implements Generator
For example, when Emitter calls JavaWriterFactory for a Binding Writer, it returns a JavaBindingWriter. JavaBindingWriter, in turn, contains a JavaStubWriter, JavaSkelWriter, and JavaImplWriter since a Binding may cause a stub, skeleton, and impl template to be generated.
Note that the writers that are given to Emitter by JavaWriterFactory DO NOT extend JavaWriter. They simply implement Writer and delegate the actual task of writing to extensions of JavaWriter.
All of Wsdl2java's Writer implementations follow a common behaviour. JavaWriter is the abstract base class that dictates this common behaviour. This behaviour is primarily placed within the generate method. The generate method calls, in succession (note: the starred methods are the ones you are probably most interested in):
Modifier and Type | Field and Description |
---|---|
protected Emitter |
emitter
Field emitter
|
protected static int |
LINE_LENGTH
This controls how many characters per line for javadoc comments
|
protected String |
type
Field type
|
Modifier | Constructor and Description |
---|---|
protected |
JavaWriter(Emitter emitter,
String type)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
closePrintWriter(PrintWriter pw)
Close the print writer.
|
void |
generate()
Generate a file.
|
protected abstract String |
getFileName()
This method must be implemented by a subclass.
|
protected String |
getJavadocDescriptionPart(String documentation,
boolean addTab)
Takes out new lines and wraps at Javadoc tags
|
protected PrintWriter |
getPrintWriter(String filename)
You should not need to override this method.
|
protected boolean |
isFileGenerated(String file)
You should not need to override this method.
|
protected void |
registerFile(String file)
You should not need to override this method.
|
protected String |
verboseMessage(String file)
Return the string: "Generating
|
protected void |
writeComment(PrintWriter pw,
Element element)
Output a documentation element as a Java comment.
|
protected void |
writeComment(PrintWriter pw,
Element element,
boolean addTab)
Output a documentation element as a Java comment.
|
protected abstract void |
writeFileBody(PrintWriter pw)
This method must be implemented by a subclass.
|
protected void |
writeFileFooter(PrintWriter pw)
You may want to override this method.
|
protected void |
writeFileHeader(PrintWriter pw)
This method is intended to be overridden as necessary
to generate file header information.
|
protected static final int LINE_LENGTH
protected Emitter emitter
protected String type
public void generate() throws IOException
generate
in interface Generator
IOException
protected abstract String getFileName()
protected boolean isFileGenerated(String file)
file
- protected void registerFile(String file)
file
- protected String verboseMessage(String file)
file
- protected PrintWriter getPrintWriter(String filename) throws IOException
filename
- IOException
protected void writeFileHeader(PrintWriter pw) throws IOException
pw
- IOException
protected abstract void writeFileBody(PrintWriter pw) throws IOException
pw
- IOException
protected void writeFileFooter(PrintWriter pw) throws IOException
pw
- IOException
protected void closePrintWriter(PrintWriter pw)
pw
- protected String getJavadocDescriptionPart(String documentation, boolean addTab)
documentation
- the raw comments from schemaaddTab
- if true adds a tab character when wrapping (methods)protected void writeComment(PrintWriter pw, Element element)
pw
- element
- protected void writeComment(PrintWriter pw, Element element, boolean addTab)
pw
- element
- addTab
- Copyright © The Apache Software Foundation. All Rights Reserved.