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.xml.ws.api.model;
038:
039: import com.sun.xml.bind.api.Bridge;
040:
041: import javax.xml.namespace.QName;
042: import javax.xml.ws.Holder;
043: import javax.jws.WebParam;
044: import javax.jws.WebParam.Mode;
045:
046: /**
047: * Runtime Parameter that abstracts the annotated java parameter
048: * <p/>
049: * <p/>
050: * A parameter may be bound to a header, a body, or an attachment.
051: * Note that when it's bound to a body, it's bound to a body,
052: * it binds to the whole payload.
053: * <p/>
054: * <p/>
055: * Sometimes multiple Java parameters are packed into the payload,
056: * in which case the subclass {@link com.sun.xml.ws.model.WrapperParameter} is used.
057: *
058: * @author Vivek Pandey
059: */
060: public interface Parameter {
061: /**
062: * Gets the root {@link SEIModel} that owns this model.
063: */
064: SEIModel getOwner();
065:
066: /**
067: * Gets the parent {@link JavaMethod} to which this parameter belongs.
068: */
069: JavaMethod getParent();
070:
071: /**
072: * @return Returns the {@link QName} of the payload/infoset of a SOAP body or header.
073: */
074: QName getName();
075:
076: /**
077: * Gives the {@link Bridge} associated with this Parameter
078: */
079: Bridge getBridge();
080:
081: /**
082: * @return Returns the mode, such as IN, OUT or INOUT.
083: */
084: Mode getMode();
085:
086: /**
087: * Position of a parameter in the method signature. It would be -1 if the parameter is a return.
088: *
089: * @return Returns the index.
090: */
091: int getIndex();
092:
093: /**
094: * @return true if <tt>this instanceof {@link com.sun.xml.ws.model.WrapperParameter}</tt>.
095: */
096: boolean isWrapperStyle();
097:
098: /**
099: * Returns true if this parameter is bound to the return value from the {@link JavaMethod}.
100: *
101: * <p>
102: * Just the convenience method for <tt>getIndex()==-1</tt>
103: */
104: boolean isReturnValue();
105:
106: /**
107: * Returns the binding associated with the parameter. For IN parameter the binding will be
108: * same as {@link #getInBinding()}, for OUT parameter the binding will be same as
109: * {@link #getOutBinding()} and for INOUT parameter the binding will be same as calling
110: * {@link #getInBinding()}
111: *
112: * @return the Binding for this Parameter. Returns {@link ParameterBinding#BODY} by default.
113: */
114: ParameterBinding getBinding();
115:
116: /**
117: * Returns the {@link ParameterBinding} associated with the IN mode
118: *
119: * @return the binding
120: */
121: ParameterBinding getInBinding();
122:
123: /**
124: * Returns the {@link ParameterBinding} associated with the OUT mode
125: *
126: * @return the binding
127: */
128: ParameterBinding getOutBinding();
129:
130: /**
131: * @return true if the {@link Mode} associated with the parameter is {@link Mode#IN} and false otherwise.
132: */
133: boolean isIN();
134:
135: /**
136: * @return true if the {@link Mode} associated with the parameter is {@link Mode#OUT} and false otherwise.
137: */
138: boolean isOUT();
139:
140: /**
141: * @return true if the {@link Mode} associated with the parameter is {@link Mode#INOUT} and false otherwise.
142: */
143: boolean isINOUT();
144:
145: /**
146: * If true, this parameter maps to the return value of a method invocation.
147: *
148: * <p>
149: * {@link JavaMethod#getResponseParameters()} is guaranteed to have
150: * at most one such {@link Parameter}. Note that there coule be none,
151: * in which case the method returns <tt>void</tt>.
152: *
153: * <p>
154: * Other response parameters are bound to {@link Holder}.
155: */
156: boolean isResponse();
157:
158: /**
159: * Gets the holder value if applicable. To be called for inbound client side
160: * message.
161: *
162: * @param obj
163: * @return the holder value if applicable.
164: */
165: Object getHolderValue(Object obj);
166:
167: /**
168: * Gives the wsdl:part@name value
169: *
170: * @return Value of {@link WebParam#partName()} annotation if present,
171: * otherwise its the localname of the infoset associated with the parameter
172: */
173: String getPartName();
174: }
|