325N/A/*
325N/A * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
325N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
325N/A *
325N/A * This code is free software; you can redistribute it and/or modify it
325N/A * under the terms of the GNU General Public License version 2 only, as
325N/A * published by the Free Software Foundation. Oracle designates this
325N/A * particular file as subject to the "Classpath" exception as provided
325N/A * by Oracle in the LICENSE file that accompanied this code.
325N/A *
325N/A * This code is distributed in the hope that it will be useful, but WITHOUT
325N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
325N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
325N/A * version 2 for more details (a copy is included in the LICENSE file that
325N/A * accompanied this code).
325N/A *
325N/A * You should have received a copy of the GNU General Public License version
325N/A * 2 along with this work; if not, write to the Free Software Foundation,
325N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
325N/A *
325N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
325N/A * or visit www.oracle.com if you need additional information or have any
325N/A * questions.
325N/A */
325N/A
325N/Apackage com.sun.xml.internal.ws.model;
325N/A
325N/Aimport com.sun.xml.internal.bind.api.CompositeStructure;
325N/Aimport com.sun.xml.internal.bind.api.TypeReference;
325N/Aimport com.sun.xml.internal.ws.api.model.JavaMethod;
325N/Aimport com.sun.xml.internal.ws.api.model.ParameterBinding;
325N/A
325N/Aimport javax.jws.WebParam.Mode;
325N/Aimport java.util.ArrayList;
325N/Aimport java.util.List;
325N/A
325N/A/**
325N/A * {@link ParameterImpl} that represents a wrapper,
325N/A * which is a parameter that consists of multiple nested {@link ParameterImpl}s
325N/A * within, which together form a body part.
325N/A *
325N/A * <p>
325N/A * Java method parameters represented by nested {@link ParameterImpl}s will be
325N/A * packed into a "wrapper bean" and it becomes the {@link ParameterImpl} for the
325N/A * body.
325N/A *
325N/A * <p>
325N/A * This parameter is only used for the {@link ParameterBinding#BODY} binding.
325N/A * Other parameters that bind to other parts (such as headers or unbound)
325N/A * will show up directly under {@link JavaMethod}.
325N/A *
325N/A * @author Vivek Pandey
325N/A */
325N/Apublic class WrapperParameter extends ParameterImpl {
325N/A protected final List<ParameterImpl> wrapperChildren = new ArrayList<ParameterImpl>();
325N/A
325N/A // TODO: wrapper parameter doesn't use 'typeRef' --- it only uses tag name.
325N/A public WrapperParameter(JavaMethodImpl parent, TypeReference typeRef, Mode mode, int index) {
325N/A super(parent, typeRef, mode, index);
325N/A }
325N/A
325N/A /**
325N/A *
325N/A * @deprecated
325N/A * Why are you calling a method that always return true?
325N/A */
325N/A @Override
325N/A public boolean isWrapperStyle() {
325N/A return true;
325N/A }
325N/A
325N/A /**
325N/A * @return Returns the wrapperChildren.
325N/A */
325N/A public List<ParameterImpl> getWrapperChildren() {
325N/A return wrapperChildren;
325N/A }
325N/A
325N/A /**
325N/A * Adds a new child parameter.
325N/A *
325N/A * @param wrapperChild
325N/A */
325N/A public void addWrapperChild(ParameterImpl wrapperChild) {
325N/A wrapperChildren.add(wrapperChild);
325N/A // must bind to body. see class javadoc
325N/A assert wrapperChild.getBinding()== ParameterBinding.BODY;
325N/A }
325N/A
325N/A public void clear(){
325N/A wrapperChildren.clear();
325N/A }
325N/A
325N/A @Override
325N/A void fillTypes(List<TypeReference> types) {
325N/A super.fillTypes(types);
325N/A if(getParent().getBinding().isRpcLit()) {
325N/A // for rpc/lit, we need to individually marshal/unmarshal wrapped values,
325N/A // so their TypeReference needs to be collected
325N/A assert getTypeReference().type==CompositeStructure.class;
325N/A for (ParameterImpl p : wrapperChildren)
325N/A p.fillTypes(types);
325N/A }
325N/A }
325N/A}