org.apache.axis.wsdl.toJava

Class JavaBeanWriter

public class JavaBeanWriter extends JavaClassWriter

This is Wsdl2java's Complex Type Writer. It writes the .java file.
Field Summary
protected booleanenableDefaultConstructor
Field enableDefaultConstructor
protected booleanenableEquals
Field enableEquals
protected booleanenableFullConstructor
Field enableFullConstructor
protected booleanenableGetters
Field enableGetters
protected booleanenableHashCode
Field enableHashCode
protected booleanenableMemberFields
Field enableMemberFields
protected booleanenableSetters
Field enableSetters
protected booleanenableSimpleConstructors
Field enableSimpleConstructors
protected booleanenableToString
Field enableToString
protected SetenumerationTypes
Field enumerationTypes
protected JavaBeanHelperWriterhelper
Field helper
protected booleanisAny
Field isAny
protected booleanisMixed
Field isMixed
protected Vectornames
Field names
protected booleanparentIsAny
Field parentIsAny
protected booleanparentIsMixed
Field parentIsMixed
protected PrintWriterpw
Field pw
protected ArrayListsimpleValueTypes
Field simpleValueTypes
Constructor Summary
protected JavaBeanWriter(Emitter emitter, TypeEntry type, Vector elements, TypeEntry extendType, Vector attributes, JavaWriter helper)
Constructor.
Method Summary
voidgenerate()
Generate a java source file and/or helper source file.
protected StringgetBinaryTypeEncoderName(String elementName)
Returns the class name that should be used to serialize and deserialize this binary element
protected StringgetClassModifiers()
Returns the appropriate extends text
protected TypeEntrygetElementDecl(String elementName)
Returns the TypeEntry of the given element
protected StringgetExtendsText()
Returns the appropriate extends text
protected StringgetImplementsText()
Returns the appropriate implements text
protected voidpreprocess()
Builds the names String vector.
protected voidwriteAccessMethods()
Writes the setter and getter methods
protected voidwriteDefaultConstructor()
Writes the default constructor.
protected voidwriteEqualsMethod()
Writes a general purpose equals method
protected voidwriteFileBody(PrintWriter pw)
Generate the binding for the given complex type.
protected voidwriteFileHeader(PrintWriter pw)
Write a common header, including the package name, the class declaration, and the opening curly brace.
protected voidwriteFullConstructor()
Writes the full constructor.
protected voidwriteHashCodeMethod()
Writes a general purpose hashCode method.
protected voidwriteMemberFields()
Writes the member fields.
protected voidwriteMinimalConstructor()
protected voidwriteSimpleConstructors()
Writes the constructors for SimpleTypes.
protected voidwriteSimpleTypeGetter(String simpleValueType, String name, String returnString)
Method writeSimpleTypeGetter
protected voidwriteSimpleTypeSetter(String simpleValueType)
Method writeSimpleTypeSetter
protected voidwriteToStringMethod()
Writes the toString method Currently the toString method is only written for simpleTypes.

Field Detail

enableDefaultConstructor

protected boolean enableDefaultConstructor
Field enableDefaultConstructor

enableEquals

protected boolean enableEquals
Field enableEquals

enableFullConstructor

protected boolean enableFullConstructor
Field enableFullConstructor

enableGetters

protected boolean enableGetters
Field enableGetters

enableHashCode

protected boolean enableHashCode
Field enableHashCode

enableMemberFields

protected boolean enableMemberFields
Field enableMemberFields

enableSetters

protected boolean enableSetters
Field enableSetters

enableSimpleConstructors

protected boolean enableSimpleConstructors
Field enableSimpleConstructors

enableToString

protected boolean enableToString
Field enableToString

enumerationTypes

protected Set enumerationTypes
Field enumerationTypes

helper

protected JavaBeanHelperWriter helper
Field helper

isAny

protected boolean isAny
Field isAny

isMixed

protected boolean isMixed
Field isMixed

names

protected Vector names
Field names

parentIsAny

protected boolean parentIsAny
Field parentIsAny

parentIsMixed

protected boolean parentIsMixed
Field parentIsMixed

pw

protected PrintWriter pw
Field pw

simpleValueTypes

protected ArrayList simpleValueTypes
Field simpleValueTypes

Constructor Detail

JavaBeanWriter

protected JavaBeanWriter(Emitter emitter, TypeEntry type, Vector elements, TypeEntry extendType, Vector attributes, JavaWriter helper)
Constructor.

Parameters: emitter type The type representing this class elements Vector containing the Type and name of each property extendType The type representing the extended class (or null) attributes Vector containing the attribute types and names helper Helper class writer

Method Detail

generate

public void generate()
Generate a java source file and/or helper source file. If the emitter works in deploy mode and the class already exists, only the helper is generated. Otherwise, the java bean and helper source are generated.

getBinaryTypeEncoderName

protected String getBinaryTypeEncoderName(String elementName)
Returns the class name that should be used to serialize and deserialize this binary element

getClassModifiers

protected String getClassModifiers()
Returns the appropriate extends text

Returns: "" or "abstract "

getElementDecl

protected TypeEntry getElementDecl(String elementName)
Returns the TypeEntry of the given element

getExtendsText

protected String getExtendsText()
Returns the appropriate extends text

Returns: "" or " extends "

getImplementsText

protected String getImplementsText()
Returns the appropriate implements text

Returns: " implements "

preprocess

protected void preprocess()
Builds the names String vector. The even indices are the java class names of the member fields. The odd indices are the member variable names. Also sets the simpleValueType variable to the java class name of the simple value if this bean represents a simple type

writeAccessMethods

protected void writeAccessMethods()
Writes the setter and getter methods

writeDefaultConstructor

protected void writeDefaultConstructor()
Writes the default constructor.

writeEqualsMethod

protected void writeEqualsMethod()
Writes a general purpose equals method

writeFileBody

protected void writeFileBody(PrintWriter pw)
Generate the binding for the given complex type.

Parameters: pw

Throws: IOException

writeFileHeader

protected void writeFileHeader(PrintWriter pw)
Write a common header, including the package name, the class declaration, and the opening curly brace. Prints javadoc from WSDL documentation. (Cannot pull up, type DOM not avail)

writeFullConstructor

protected void writeFullConstructor()
Writes the full constructor. Note that this class is not recommended for JSR 101 compliant beans, but is provided for extended classes which may wish to generate a full constructor.

writeHashCodeMethod

protected void writeHashCodeMethod()
Writes a general purpose hashCode method.

writeMemberFields

protected void writeMemberFields()
Writes the member fields.

writeMinimalConstructor

protected void writeMinimalConstructor()

writeSimpleConstructors

protected void writeSimpleConstructors()
Writes the constructors for SimpleTypes. Writes a constructor accepting a string and a constructor accepting the simple java type.

writeSimpleTypeGetter

protected void writeSimpleTypeGetter(String simpleValueType, String name, String returnString)
Method writeSimpleTypeGetter

Parameters: simpleValueType name returnString

writeSimpleTypeSetter

protected void writeSimpleTypeSetter(String simpleValueType)
Method writeSimpleTypeSetter

Parameters: simpleValueType

writeToStringMethod

protected void writeToStringMethod()
Writes the toString method Currently the toString method is only written for simpleTypes.
Copyright B) 2005 Apache Web Services Project. All Rights Reserved.