1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/share/jaxws_classes/com/sun/tools/internal/ws/processor/model/Parameter.java Wed Apr 27 01:27:09 2016 +0800 1.3 @@ -0,0 +1,193 @@ 1.4 +/* 1.5 + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 + * 1.8 + * This code is free software; you can redistribute it and/or modify it 1.9 + * under the terms of the GNU General Public License version 2 only, as 1.10 + * published by the Free Software Foundation. Oracle designates this 1.11 + * particular file as subject to the "Classpath" exception as provided 1.12 + * by Oracle in the LICENSE file that accompanied this code. 1.13 + * 1.14 + * This code is distributed in the hope that it will be useful, but WITHOUT 1.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.17 + * version 2 for more details (a copy is included in the LICENSE file that 1.18 + * accompanied this code). 1.19 + * 1.20 + * You should have received a copy of the GNU General Public License version 1.21 + * 2 along with this work; if not, write to the Free Software Foundation, 1.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.23 + * 1.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 1.25 + * or visit www.oracle.com if you need additional information or have any 1.26 + * questions. 1.27 + */ 1.28 + 1.29 +package com.sun.tools.internal.ws.processor.model; 1.30 + 1.31 +import com.sun.tools.internal.ws.processor.model.java.JavaParameter; 1.32 +import com.sun.tools.internal.ws.wsdl.framework.Entity; 1.33 +import com.sun.tools.internal.ws.wsdl.document.MessagePart; 1.34 + 1.35 +import javax.jws.WebParam.Mode; 1.36 +import java.util.ArrayList; 1.37 +import java.util.List; 1.38 + 1.39 +/** 1.40 + * 1.41 + * @author WS Development Team 1.42 + */ 1.43 +public class Parameter extends ModelObject { 1.44 + private final String entityName; 1.45 + 1.46 + public Parameter(String name, Entity entity) { 1.47 + super(entity); 1.48 + this.name = name; 1.49 + if(entity instanceof com.sun.tools.internal.ws.wsdl.document.Message){ 1.50 + this.entityName = ((com.sun.tools.internal.ws.wsdl.document.Message)entity).getName(); 1.51 + }else if(entity instanceof MessagePart){ 1.52 + this.entityName = ((MessagePart)entity).getName(); 1.53 + }else{ 1.54 + this.entityName = name; 1.55 + } 1.56 + 1.57 + } 1.58 + 1.59 + 1.60 + public String getEntityName() { 1.61 + return entityName; 1.62 + } 1.63 + 1.64 + public String getName() { 1.65 + return name; 1.66 + } 1.67 + 1.68 + public void setName(String s) { 1.69 + name = s; 1.70 + } 1.71 + 1.72 + public JavaParameter getJavaParameter() { 1.73 + return javaParameter; 1.74 + } 1.75 + 1.76 + public void setJavaParameter(JavaParameter p) { 1.77 + javaParameter = p; 1.78 + } 1.79 + 1.80 + public AbstractType getType() { 1.81 + return type; 1.82 + } 1.83 + 1.84 + public void setType(AbstractType t) { 1.85 + type = t; 1.86 + } 1.87 + 1.88 + public String getTypeName() { 1.89 + return typeName; 1.90 + } 1.91 + 1.92 + public void setTypeName(String t) { 1.93 + typeName = t; 1.94 + } 1.95 + 1.96 + public Block getBlock() { 1.97 + return block; 1.98 + } 1.99 + 1.100 + public void setBlock(Block d) { 1.101 + block = d; 1.102 + } 1.103 + 1.104 + public Parameter getLinkedParameter() { 1.105 + return link; 1.106 + } 1.107 + 1.108 + public void setLinkedParameter(Parameter p) { 1.109 + link = p; 1.110 + } 1.111 + 1.112 + public boolean isEmbedded() { 1.113 + return embedded; 1.114 + } 1.115 + 1.116 + public void setEmbedded(boolean b) { 1.117 + embedded = b; 1.118 + } 1.119 + 1.120 + public void accept(ModelVisitor visitor) throws Exception { 1.121 + visitor.visit(this); 1.122 + } 1.123 + 1.124 + private String name; 1.125 + private JavaParameter javaParameter; 1.126 + private AbstractType type; 1.127 + private Block block; 1.128 + private Parameter link; 1.129 + private boolean embedded; 1.130 + private String typeName; 1.131 + private String customName; 1.132 + private Mode mode; 1.133 + 1.134 + public int getParameterIndex() { 1.135 + return parameterOrderPosition; 1.136 + } 1.137 + 1.138 + public void setParameterIndex(int parameterOrderPosition) { 1.139 + this.parameterOrderPosition = parameterOrderPosition; 1.140 + } 1.141 + 1.142 + public boolean isReturn(){ 1.143 + return (parameterOrderPosition == -1); 1.144 + } 1.145 + 1.146 + // 0 is the first parameter, -1 is the return type 1.147 + private int parameterOrderPosition; 1.148 + /** 1.149 + * @return Returns the customName. 1.150 + */ 1.151 + public String getCustomName() { 1.152 + return customName; 1.153 + } 1.154 + /** 1.155 + * @param customName The customName to set. 1.156 + */ 1.157 + public void setCustomName(String customName) { 1.158 + this.customName = customName; 1.159 + } 1.160 + 1.161 + private List<String> annotations = new ArrayList<String>(); 1.162 + 1.163 + /** 1.164 + * @return Returns the annotations. 1.165 + */ 1.166 + public List<String> getAnnotations() { 1.167 + return annotations; 1.168 + } 1.169 + 1.170 + 1.171 + /** 1.172 + * @param annotations The annotations to set. 1.173 + */ 1.174 + public void setAnnotations(List<String> annotations) { 1.175 + this.annotations = annotations; 1.176 + } 1.177 + 1.178 + public void setMode(Mode mode){ 1.179 + this.mode = mode; 1.180 + } 1.181 + 1.182 + public boolean isIN(){ 1.183 + return (mode == Mode.IN); 1.184 + } 1.185 + 1.186 + public boolean isOUT(){ 1.187 + return (mode == Mode.OUT); 1.188 + } 1.189 + 1.190 + public boolean isINOUT(){ 1.191 + return (mode == Mode.INOUT); 1.192 + } 1.193 + 1.194 + 1.195 + 1.196 +}