ohair@286: /* ohair@286: * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. ohair@286: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. ohair@286: * ohair@286: * This code is free software; you can redistribute it and/or modify it ohair@286: * under the terms of the GNU General Public License version 2 only, as ohair@286: * published by the Free Software Foundation. Oracle designates this ohair@286: * particular file as subject to the "Classpath" exception as provided ohair@286: * by Oracle in the LICENSE file that accompanied this code. ohair@286: * ohair@286: * This code is distributed in the hope that it will be useful, but WITHOUT ohair@286: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ohair@286: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ohair@286: * version 2 for more details (a copy is included in the LICENSE file that ohair@286: * accompanied this code). ohair@286: * ohair@286: * You should have received a copy of the GNU General Public License version ohair@286: * 2 along with this work; if not, write to the Free Software Foundation, ohair@286: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. ohair@286: * ohair@286: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ohair@286: * or visit www.oracle.com if you need additional information or have any ohair@286: * questions. ohair@286: */ ohair@286: ohair@286: package com.sun.xml.internal.ws.model; ohair@286: ohair@286: import com.sun.xml.internal.ws.api.model.JavaMethod; ohair@286: import com.sun.xml.internal.ws.api.model.ParameterBinding; ohair@286: import com.sun.xml.internal.ws.spi.db.TypeInfo; ohair@286: ohair@286: import javax.jws.WebParam.Mode; ohair@286: import java.util.ArrayList; ohair@286: import java.util.List; ohair@286: ohair@286: /** ohair@286: * {@link ParameterImpl} that represents a wrapper, ohair@286: * which is a parameter that consists of multiple nested {@link ParameterImpl}s ohair@286: * within, which together form a body part. ohair@286: * ohair@286: *

ohair@286: * Java method parameters represented by nested {@link ParameterImpl}s will be ohair@286: * packed into a "wrapper bean" and it becomes the {@link ParameterImpl} for the ohair@286: * body. ohair@286: * ohair@286: *

ohair@286: * This parameter is only used for the {@link ParameterBinding#BODY} binding. ohair@286: * Other parameters that bind to other parts (such as headers or unbound) ohair@286: * will show up directly under {@link JavaMethod}. ohair@286: * ohair@286: * @author Vivek Pandey ohair@286: */ ohair@286: public class WrapperParameter extends ParameterImpl { ohair@286: protected final List wrapperChildren = new ArrayList(); ohair@286: ohair@286: // TODO: wrapper parameter doesn't use 'typeRef' --- it only uses tag name. ohair@286: public WrapperParameter(JavaMethodImpl parent, TypeInfo typeRef, Mode mode, int index) { ohair@286: super(parent, typeRef, mode, index); ohair@286: //chen workaround for document-literal wrapper - new feature on eclipselink API requested ohair@286: typeRef.properties().put(WrapperParameter.class.getName(), this); ohair@286: } ohair@286: ohair@286: /** ohair@286: * ohair@286: * @deprecated ohair@286: * Why are you calling a method that always return true? ohair@286: */ ohair@286: @Override ohair@286: public boolean isWrapperStyle() { ohair@286: return true; ohair@286: } ohair@286: ohair@286: /** ohair@286: * @return Returns the wrapperChildren. ohair@286: */ ohair@286: public List getWrapperChildren() { ohair@286: return wrapperChildren; ohair@286: } ohair@286: ohair@286: /** ohair@286: * Adds a new child parameter. ohair@286: * ohair@286: * @param wrapperChild ohair@286: */ ohair@286: public void addWrapperChild(ParameterImpl wrapperChild) { ohair@286: wrapperChildren.add(wrapperChild); ohair@286: // must bind to body. see class javadoc ohair@286: assert wrapperChild.getBinding()== ParameterBinding.BODY; ohair@286: } ohair@286: ohair@286: public void clear(){ ohair@286: wrapperChildren.clear(); ohair@286: } ohair@286: ohair@286: @Override ohair@286: void fillTypes(List types) { ohair@286: super.fillTypes(types); ohair@286: if(getParent().getBinding().isRpcLit()) { ohair@286: // for rpc/lit, we need to individually marshal/unmarshal wrapped values, ohair@286: // so their TypeReference needs to be collected ohair@286: // assert getTypeReference().type==CompositeStructure.class; ohair@286: for (ParameterImpl p : wrapperChildren) ohair@286: p.fillTypes(types); ohair@286: } ohair@286: } ohair@286: }