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

changeset 286
f50545b5e2f1
child 368
0989ad8c0860
equal deleted inserted replaced
284:88b85470e72c 286:f50545b5e2f1
1 /*
2 * Copyright (c) 1997, 2011, 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
32 import javax.jws.WebParam.Mode;
33 import java.util.ArrayList;
34 import java.util.List;
35
36 /**
37 * {@link ParameterImpl} that represents a wrapper,
38 * which is a parameter that consists of multiple nested {@link ParameterImpl}s
39 * within, which together form a body part.
40 *
41 * <p>
42 * Java method parameters represented by nested {@link ParameterImpl}s will be
43 * packed into a "wrapper bean" and it becomes the {@link ParameterImpl} for the
44 * body.
45 *
46 * <p>
47 * This parameter is only used for the {@link ParameterBinding#BODY} binding.
48 * Other parameters that bind to other parts (such as headers or unbound)
49 * will show up directly under {@link JavaMethod}.
50 *
51 * @author Vivek Pandey
52 */
53 public class WrapperParameter extends ParameterImpl {
54 protected final List<ParameterImpl> wrapperChildren = new ArrayList<ParameterImpl>();
55
56 // TODO: wrapper parameter doesn't use 'typeRef' --- it only uses tag name.
57 public WrapperParameter(JavaMethodImpl parent, TypeInfo typeRef, Mode mode, int index) {
58 super(parent, typeRef, mode, index);
59 //chen workaround for document-literal wrapper - new feature on eclipselink API requested
60 typeRef.properties().put(WrapperParameter.class.getName(), this);
61 }
62
63 /**
64 *
65 * @deprecated
66 * Why are you calling a method that always return true?
67 */
68 @Override
69 public boolean isWrapperStyle() {
70 return true;
71 }
72
73 /**
74 * @return Returns the wrapperChildren.
75 */
76 public List<ParameterImpl> getWrapperChildren() {
77 return wrapperChildren;
78 }
79
80 /**
81 * Adds a new child parameter.
82 *
83 * @param wrapperChild
84 */
85 public void addWrapperChild(ParameterImpl wrapperChild) {
86 wrapperChildren.add(wrapperChild);
87 // must bind to body. see class javadoc
88 assert wrapperChild.getBinding()== ParameterBinding.BODY;
89 }
90
91 public void clear(){
92 wrapperChildren.clear();
93 }
94
95 @Override
96 void fillTypes(List<TypeInfo> types) {
97 super.fillTypes(types);
98 if(getParent().getBinding().isRpcLit()) {
99 // for rpc/lit, we need to individually marshal/unmarshal wrapped values,
100 // so their TypeReference needs to be collected
101 // assert getTypeReference().type==CompositeStructure.class;
102 for (ParameterImpl p : wrapperChildren)
103 p.fillTypes(types);
104 }
105 }
106 }

mercurial