public abstract class JavaClassWriter extends JavaWriter
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. Many of the files generated are .java files, so this abstract class - JavaClassWriter - exists. It extends JavaWriter and adds a bit of Java- relative 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 String |
className
Field className
|
protected Namespaces |
namespaces
Field namespaces
|
protected String |
packageName
Field packageName
|
emitter, LINE_LENGTH, type
Modifier | Constructor and Description |
---|---|
protected |
JavaClassWriter(Emitter emitter,
String fullClassName,
String type)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected String |
getClassModifiers()
Return "public ".
|
protected String |
getClassName()
Returns the class name.
|
protected String |
getClassText()
Return "class ".
|
protected String |
getExtendsText()
Returns the appropriate extends clause.
|
protected String |
getFileName()
Return the file name as a string of the form:
"
|
protected String |
getImplementsText()
Returns the appropriate implements clause.
|
protected String |
getPackage()
Returns the package name.
|
protected void |
registerFile(String file)
You should not need to override this method.
|
protected void |
writeFileFooter(PrintWriter pw)
Generate the closing curly brace.
|
protected void |
writeFileHeader(PrintWriter pw)
Write a common header, including the package name, the class
declaration, and the opening curly brace.
|
protected void |
writeHeaderComments(PrintWriter pw)
Write the header comments.
|
protected void |
writePackage(PrintWriter pw)
Write the package declaration statement.
|
closePrintWriter, generate, getJavadocDescriptionPart, getPrintWriter, isFileGenerated, verboseMessage, writeComment, writeComment, writeFileBody
protected Namespaces namespaces
protected String className
protected String packageName
protected String getFileName()
getFileName
in class JavaWriter
protected void registerFile(String file)
registerFile
in class JavaWriter
file
- protected void writeFileHeader(PrintWriter pw) throws IOException
writeFileHeader
in class JavaWriter
pw
- IOException
protected void writeHeaderComments(PrintWriter pw) throws IOException
pw
- IOException
protected void writePackage(PrintWriter pw) throws IOException
pw
- IOException
protected String getClassModifiers()
protected String getClassText()
protected String getExtendsText()
protected String getImplementsText()
protected String getPackage()
protected String getClassName()
protected void writeFileFooter(PrintWriter pw) throws IOException
writeFileFooter
in class JavaWriter
pw
- IOException
Copyright © The Apache Software Foundation. All Rights Reserved.