View Javadoc

1   /*
2    * Copyright 2001-2004 The Apache Software Foundation.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.apache.geronimo.ews.jaxrpcmapping;
17  
18  import org.apache.axis.wsdl.symbolTable.TypeEntry;
19  import org.apache.axis.wsdl.toJava.JavaClassWriter;
20  import org.apache.axis.wsdl.toJava.Utils;
21  
22  import java.io.IOException;
23  import java.io.PrintWriter;
24  
25  /***
26   * This is Wsdl2java's Holder Writer.  It writes the <typeName>Holder.java file.
27   *
28   * @author Ias (iasandcb@tmax.co.kr)
29   * @deprecated no more used by J2eeGeneratorFactory
30   */
31  public class J2eeHolderWriter extends JavaClassWriter {
32      private TypeEntry type;
33  
34      /***
35       * Constructor.
36       */
37      protected J2eeHolderWriter(J2eeEmitter emitter, TypeEntry type) {
38          super(emitter, Utils.holder(type, emitter), "holder");
39          this.type = type;
40      } // ctor
41  
42      /***
43       * Return "public final ".
44       */
45      protected String getClassModifiers() {
46          return super.getClassModifiers() + "final ";
47      } // getClassModifiers
48  
49      /***
50       * Return "implements javax.xml.rpc.holders.Holder ".
51       */
52      protected String getImplementsText() {
53          return "implements javax.xml.rpc.holders.Holder ";
54      } // getImplementsText
55  
56      /***
57       * Generate the holder for the given complex type.
58       */
59      protected void writeFileBody(PrintWriter pw) throws IOException {
60          String holderType = type.getName();
61          pw.println("    public " + holderType + " value;");
62          pw.println();
63          pw.println("    public " + className + "() {");
64          pw.println("    }");
65          pw.println();
66          pw.println("    public " + className + "(" + holderType + " value) {");
67          pw.println("        this.value = value;");
68          pw.println("    }");
69          pw.println();
70      } // writeOperation
71  
72  }