001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common Development
008: * and Distribution License("CDDL") (collectively, the "License"). You
009: * may not use this file except in compliance with the License. You can obtain
010: * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
011: * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
012: * language governing permissions and limitations under the License.
013: *
014: * When distributing the software, include this License Header Notice in each
015: * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
016: * Sun designates this particular file as subject to the "Classpath" exception
017: * as provided by Sun in the GPL Version 2 section of the License file that
018: * accompanied this code. If applicable, add the following below the License
019: * Header, with the fields enclosed by brackets [] replaced by your own
020: * identifying information: "Portions Copyrighted [year]
021: * [name of copyright owner]"
022: *
023: * Contributor(s):
024: *
025: * If you wish your version of this file to be governed by only the CDDL or
026: * only the GPL Version 2, indicate your decision by adding "[Contributor]
027: * elects to include this software in this distribution under the [CDDL or GPL
028: * Version 2] license." If you don't indicate a single choice of license, a
029: * recipient has the option to distribute your version of this file under
030: * either the CDDL, the GPL Version 2 or to extend the choice of license to
031: * its licensees as provided above. However, if you add GPL Version 2 code
032: * and therefore, elected the GPL Version 2 license, then the option applies
033: * only if the new code is made subject to such option by the copyright
034: * holder.
035: */
036:
037: package com.sun.tools.ws.processor.model;
038:
039: import com.sun.tools.ws.processor.model.java.JavaParameter;
040: import com.sun.tools.ws.wsdl.framework.Entity;
041: import com.sun.tools.ws.wsdl.document.MessagePart;
042:
043: import javax.jws.WebParam.Mode;
044: import java.util.ArrayList;
045: import java.util.List;
046:
047: /**
048: *
049: * @author WS Development Team
050: */
051: public class Parameter extends ModelObject {
052: private final String entityName;
053:
054: public Parameter(String name, Entity entity) {
055: super (entity);
056: this .name = name;
057: if (entity instanceof com.sun.tools.ws.wsdl.document.Message) {
058: this .entityName = ((com.sun.tools.ws.wsdl.document.Message) entity)
059: .getName();
060: } else if (entity instanceof MessagePart) {
061: this .entityName = ((MessagePart) entity).getName();
062: } else {
063: this .entityName = name;
064: }
065:
066: }
067:
068: public String getEntityName() {
069: return entityName;
070: }
071:
072: public String getName() {
073: return name;
074: }
075:
076: public void setName(String s) {
077: name = s;
078: }
079:
080: public JavaParameter getJavaParameter() {
081: return javaParameter;
082: }
083:
084: public void setJavaParameter(JavaParameter p) {
085: javaParameter = p;
086: }
087:
088: public AbstractType getType() {
089: return type;
090: }
091:
092: public void setType(AbstractType t) {
093: type = t;
094: }
095:
096: public String getTypeName() {
097: return typeName;
098: }
099:
100: public void setTypeName(String t) {
101: typeName = t;
102: }
103:
104: public Block getBlock() {
105: return block;
106: }
107:
108: public void setBlock(Block d) {
109: block = d;
110: }
111:
112: public Parameter getLinkedParameter() {
113: return link;
114: }
115:
116: public void setLinkedParameter(Parameter p) {
117: link = p;
118: }
119:
120: public boolean isEmbedded() {
121: return embedded;
122: }
123:
124: public void setEmbedded(boolean b) {
125: embedded = b;
126: }
127:
128: public void accept(ModelVisitor visitor) throws Exception {
129: visitor.visit(this );
130: }
131:
132: private String name;
133: private JavaParameter javaParameter;
134: private AbstractType type;
135: private Block block;
136: private Parameter link;
137: private boolean embedded;
138: private String typeName;
139: private String customName;
140: private Mode mode;
141:
142: public int getParameterIndex() {
143: return parameterOrderPosition;
144: }
145:
146: public void setParameterIndex(int parameterOrderPosition) {
147: this .parameterOrderPosition = parameterOrderPosition;
148: }
149:
150: public boolean isReturn() {
151: return (parameterOrderPosition == -1);
152: }
153:
154: // 0 is the first parameter, -1 is the return type
155: private int parameterOrderPosition;
156:
157: /**
158: * @return Returns the customName.
159: */
160: public String getCustomName() {
161: return customName;
162: }
163:
164: /**
165: * @param customName The customName to set.
166: */
167: public void setCustomName(String customName) {
168: this .customName = customName;
169: }
170:
171: private List<String> annotations = new ArrayList<String>();
172:
173: /**
174: * @return Returns the annotations.
175: */
176: public List<String> getAnnotations() {
177: return annotations;
178: }
179:
180: /**
181: * @param annotations The annotations to set.
182: */
183: public void setAnnotations(List<String> annotations) {
184: this .annotations = annotations;
185: }
186:
187: public void setMode(Mode mode) {
188: this .mode = mode;
189: }
190:
191: public boolean isIN() {
192: return (mode == Mode.IN);
193: }
194:
195: public boolean isOUT() {
196: return (mode == Mode.OUT);
197: }
198:
199: public boolean isINOUT() {
200: return (mode == Mode.INOUT);
201: }
202:
203: }
|