src/share/jaxws_classes/com/sun/xml/internal/ws/model/WrapperParameter.java

changeset 0
373ffda63c9a
child 637
9c07ef4934dd
equal deleted inserted replaced
-1:000000000000 0:373ffda63c9a
1 /*
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package com.sun.xml.internal.ws.model;
27
28 import com.sun.xml.internal.ws.api.model.JavaMethod;
29 import com.sun.xml.internal.ws.api.model.ParameterBinding;
30 import com.sun.xml.internal.ws.spi.db.TypeInfo;
31 import com.sun.xml.internal.ws.spi.db.WrapperComposite;
32
33 import javax.jws.WebParam.Mode;
34 import java.util.ArrayList;
35 import java.util.List;
36
37 /**
38 * {@link ParameterImpl} that represents a wrapper,
39 * which is a parameter that consists of multiple nested {@link ParameterImpl}s
40 * within, which together form a body part.
41 *
42 * <p>
43 * Java method parameters represented by nested {@link ParameterImpl}s will be
44 * packed into a "wrapper bean" and it becomes the {@link ParameterImpl} for the
45 * body.
46 *
47 * <p>
48 * This parameter is only used for the {@link ParameterBinding#BODY} binding.
49 * Other parameters that bind to other parts (such as headers or unbound)
50 * will show up directly under {@link JavaMethod}.
51 *
52 * @author Vivek Pandey
53 */
54 public class WrapperParameter extends ParameterImpl {
55 protected final List<ParameterImpl> wrapperChildren = new ArrayList<ParameterImpl>();
56
57 // TODO: wrapper parameter doesn't use 'typeRef' --- it only uses tag name.
58 public WrapperParameter(JavaMethodImpl parent, TypeInfo typeRef, Mode mode, int index) {
59 super(parent, typeRef, mode, index);
60 //chen workaround for document-literal wrapper - new feature on eclipselink API requested
61 typeRef.properties().put(WrapperParameter.class.getName(), this);
62 }
63
64 /**
65 *
66 * @deprecated
67 * Why are you calling a method that always return true?
68 */
69 @Override
70 public boolean isWrapperStyle() {
71 return true;
72 }
73
74 /**
75 * @return Returns the wrapperChildren.
76 */
77 public List<ParameterImpl> getWrapperChildren() {
78 return wrapperChildren;
79 }
80
81 /**
82 * Adds a new child parameter.
83 *
84 * @param wrapperChild
85 */
86 public void addWrapperChild(ParameterImpl wrapperChild) {
87 wrapperChildren.add(wrapperChild);
88 wrapperChild.wrapper = this;
89 // must bind to body. see class javadoc
90 assert wrapperChild.getBinding()== ParameterBinding.BODY;
91 }
92
93 public void clear(){
94 wrapperChildren.clear();
95 }
96
97 @Override
98 void fillTypes(List<TypeInfo> types) {
99 super.fillTypes(types);
100 if(WrapperComposite.class.equals(getTypeInfo().type)) {
101 for (ParameterImpl p : wrapperChildren) p.fillTypes(types);
102 }
103 // if(getParent().getBinding().isRpcLit()) {
104 // // for rpc/lit, we need to individually marshal/unmarshal wrapped values,
105 // // so their TypeReference needs to be collected
106 //// assert getTypeReference().type==CompositeStructure.class;
107 // for (ParameterImpl p : wrapperChildren)
108 // p.fillTypes(types);
109 // }
110 }
111 }

mercurial