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