FileDocCategorySizeDatePackage
JavaHolderWriter.javaAPI DocApache Axis 1.43356Sat Apr 22 18:57:28 BST 2006org.apache.axis.wsdl.toJava

JavaHolderWriter

public class JavaHolderWriter extends JavaClassWriter
This is Wsdl2java's Holder Writer. It writes the Holder.java file.

Fields Summary
private org.apache.axis.wsdl.symbolTable.TypeEntry
type
Field type
Constructors Summary
protected JavaHolderWriter(Emitter emitter, org.apache.axis.wsdl.symbolTable.TypeEntry type)
Constructor.

param
emitter
param
type


        super(emitter, Utils.holder(type, emitter), "holder");

        this.type = type;
    
Methods Summary
public voidgenerate()
Generate a java source file for the holder class. If the emitter works in deploy mode and the class already exists, the source wull not be generated.

        String fqcn = getPackage() + "." + getClassName();
        if (emitter.isDeploy()) {
            if (!emitter.doesExist(fqcn)) {
                super.generate();
            }
        } else {
            super.generate();
        }
    
protected java.lang.StringgetClassModifiers()
Return "public final ".

return

        return super.getClassModifiers() + "final ";
    
protected java.lang.StringgetImplementsText()
Return "implements javax.xml.rpc.holders.Holder ".

return

        return "implements javax.xml.rpc.holders.Holder ";
    
protected voidwriteFileBody(java.io.PrintWriter pw)
Generate the holder for the given complex type.

param
pw
throws
IOException


        String holderType = type.getName();
        if ((type instanceof CollectionType 
                && ((CollectionType) type).isWrapped())
             || type.getUnderlTypeNillable()) {
            /*
             * For soapenc arrays or elements with maxOccurs="unbounded"
             * having a primitive type and nillable="true" the holderType 
             * should be the corresponding wrapped type.
             */
            holderType = Utils.getWrapperType(type);
        }
        pw.println("    public " + holderType + " value;");
        pw.println();
        pw.println("    public " + className + "() {");
        pw.println("    }");
        pw.println();
        pw.println("    public " + className + "(" + holderType + " value) {");
        pw.println("        this.value = value;");
        pw.println("    }");
        pw.println();