1 /*
   2  * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package com.sun.xml.internal.ws.api.model;
  27 
  28 import com.sun.xml.internal.bind.api.Bridge;
  29 
  30 import javax.xml.namespace.QName;
  31 import javax.xml.ws.Holder;
  32 import javax.jws.WebParam;
  33 import javax.jws.WebParam.Mode;
  34 
  35 /**
  36  * Runtime Parameter that abstracts the annotated java parameter
  37  * <p/>
  38  * <p/>
  39  * A parameter may be bound to a header, a body, or an attachment.
  40  * Note that when it's bound to a body, it's bound to a body,
  41  * it binds to the whole payload.
  42  * <p/>
  43  * <p/>
  44  * Sometimes multiple Java parameters are packed into the payload,
  45  * in which case the subclass {@link com.sun.xml.internal.ws.model.WrapperParameter} is used.
  46  *
  47  * @author Vivek Pandey
  48  */
  49 public interface Parameter {
  50     /**
  51      * Gets the root {@link SEIModel} that owns this model.
  52      */
  53     SEIModel getOwner();
  54 
  55     /**
  56      * Gets the parent {@link JavaMethod} to which this parameter belongs.
  57      */
  58     JavaMethod getParent();
  59 
  60     /**
  61      * @return Returns the {@link QName} of the payload/infoset of a SOAP body or header.
  62      */
  63     QName getName();
  64 
  65     /**
  66      * Gives the {@link Bridge} associated with this Parameter
  67      * @deprecated
  68      */
  69     Bridge getBridge();
  70 
  71     /**
  72      * @return Returns the mode, such as IN, OUT or INOUT.
  73      */
  74     Mode getMode();
  75 
  76     /**
  77      * Position of a parameter in the method signature. It would be -1 if the parameter is a return.
  78      *
  79      * @return Returns the index.
  80      */
  81     int getIndex();
  82 
  83     /**
  84      * @return true if {@code this instanceof} {@link com.sun.xml.internal.ws.model.WrapperParameter}.
  85      */
  86     boolean isWrapperStyle();
  87 
  88     /**
  89      * Returns true if this parameter is bound to the return value from the {@link JavaMethod}.
  90      *
  91      * <p>
  92      * Just the convenience method for {@code getIndex()==-1}
  93      */
  94     boolean isReturnValue();
  95 
  96     /**
  97      * Returns the binding associated with the parameter. For IN parameter the binding will be
  98      * same as {@link #getInBinding()}, for OUT parameter the binding will be same as
  99      * {@link #getOutBinding()} and for INOUT parameter the binding will be same as calling
 100      * {@link #getInBinding()}
 101      *
 102      * @return the Binding for this Parameter. Returns {@link ParameterBinding#BODY} by default.
 103      */
 104     ParameterBinding getBinding();
 105 
 106     /**
 107      * Returns the {@link ParameterBinding} associated with the IN mode
 108      *
 109      * @return the binding
 110      */
 111     ParameterBinding getInBinding();
 112 
 113     /**
 114      * Returns the {@link ParameterBinding} associated with the OUT mode
 115      *
 116      * @return the binding
 117      */
 118     ParameterBinding getOutBinding();
 119 
 120     /**
 121      * @return true if the {@link Mode} associated with the parameter is {@link Mode#IN} and false otherwise.
 122      */
 123     boolean isIN();
 124 
 125     /**
 126      * @return true if the {@link Mode} associated with the parameter is {@link Mode#OUT} and false otherwise.
 127      */
 128     boolean isOUT();
 129 
 130     /**
 131      * @return true if the {@link Mode} associated with the parameter is {@link Mode#INOUT} and false otherwise.
 132      */
 133     boolean isINOUT();
 134 
 135     /**
 136      * If true, this parameter maps to the return value of a method invocation.
 137      *
 138      * <p>
 139      * {@link JavaMethod#getResponseParameters()} is guaranteed to have
 140      * at most one such {@link Parameter}. Note that there coule be none,
 141      * in which case the method returns {@code void}.
 142      *
 143      * <p>
 144      * Other response parameters are bound to {@link Holder}.
 145      */
 146     boolean isResponse();
 147 
 148     /**
 149      * Gets the holder value if applicable. To be called for inbound client side
 150      * message.
 151      *
 152      * @param obj
 153      * @return the holder value if applicable.
 154      */
 155     Object getHolderValue(Object obj);
 156 
 157     /**
 158      * Gives the wsdl:part@name value
 159      *
 160      * @return Value of {@link WebParam#partName()} annotation if present,
 161      *         otherwise its the localname of the infoset associated with the parameter
 162      */
 163     String getPartName();
 164 }