📄 operationdesc.java
字号:
return numOutParams; } public int getNumParams() { return parameters.size(); } public Method getMethod() { return method; } public void setMethod(Method method) { this.method = method; } /** * Is the return value in the header of the response message? */ public boolean isReturnHeader() { return returnDesc.isOutHeader(); } /** * Set whether the return value is in the response message. */ public void setReturnHeader(boolean value) { returnDesc.setOutHeader(value); } public ParameterDesc getParamByQName(QName qname) { for (Iterator i = parameters.iterator(); i.hasNext();) { ParameterDesc param = (ParameterDesc) i.next(); if (param.getQName().equals(qname)) return param; } return null; } public ParameterDesc getInputParamByQName(QName qname) { ParameterDesc param = null; param = getParamByQName(qname); if ((param == null) || (param.getMode() == ParameterDesc.OUT)) { param = null; } return param; } public ParameterDesc getOutputParamByQName(QName qname) { ParameterDesc param = null; for (Iterator i = parameters.iterator(); i.hasNext();) { ParameterDesc pnext = (ParameterDesc)i.next(); if (pnext.getQName().equals(qname) && pnext.getMode() != ParameterDesc.IN) { param = pnext; break; } } if (param == null) { if (null == returnDesc.getQName() ){ param= new ParameterDesc( returnDesc); //Create copy param.setQName(qname); } else if ( qname.equals(returnDesc.getQName())) { param = returnDesc; } } return param; } /** * Return a list of ALL "in" params (including INOUTs) * * Note: if we were sure the order went IN->INOUT->OUT, we could optimize * this. * * @return */ public ArrayList getAllInParams() { ArrayList result = new ArrayList(); for (Iterator i = parameters.iterator(); i.hasNext();) { ParameterDesc desc = (ParameterDesc) i.next(); if (desc.getMode() != ParameterDesc.OUT) { result.add(desc); } } return result; } /** * Return a list of ALL "out" params (including INOUTs) * * Note: if we were sure the order went IN->INOUT->OUT, we could optimize * this. * * @return */ public ArrayList getAllOutParams() { ArrayList result = new ArrayList(); for (Iterator i = parameters.iterator(); i.hasNext();) { ParameterDesc desc = (ParameterDesc) i.next(); if (desc.getMode() != ParameterDesc.IN) { result.add(desc); } } return result; } /** * Returns an ordered list of out params (NOT inouts) */ public ArrayList getOutParams() { ArrayList result = new ArrayList(); for (Iterator i = parameters.iterator(); i.hasNext();) { ParameterDesc desc = (ParameterDesc) i.next(); if (desc.getMode() == ParameterDesc.OUT) { result.add(desc); } } return result; } public void addFault(FaultDesc fault) { if (faults == null) faults = new ArrayList(); faults.add(fault); } public ArrayList getFaults() { return faults; } /** * Returns the FaultDesc for the fault class given. * Returns null if not found. */ public FaultDesc getFaultByClass(Class cls) { if (faults == null || cls == null) { return null; } while (cls != null) { // Check each class in the inheritance hierarchy, stopping at // java.* or javax.* classes. for (Iterator iterator = faults.iterator(); iterator.hasNext();) { FaultDesc desc = (FaultDesc) iterator.next(); if (cls.getName().equals(desc.getClassName())) { return desc; } } cls = cls.getSuperclass(); if (cls != null && (cls.getName().startsWith("java.") || cls.getName().startsWith("javax."))) { cls = null; } } return null; } /** * Returns the FaultDesc for the fault class given. * Returns null if not found. */ public FaultDesc getFaultByClass(Class cls, boolean checkParents) { if (checkParents) { return getFaultByClass(cls); } if (faults == null || cls == null) { return null; } for (Iterator iterator = faults.iterator(); iterator.hasNext();) { FaultDesc desc = (FaultDesc) iterator.next(); if (cls.getName().equals(desc.getClassName())) { return desc; } } return null; } /** * Returns the FaultDesc for a QName (which is typically found * in the details element of a SOAP fault). * Returns null if not found. */ public FaultDesc getFaultByQName(QName qname) { if (faults != null) { for (Iterator iterator = faults.iterator(); iterator.hasNext();) { FaultDesc desc = (FaultDesc) iterator.next(); if (qname.equals(desc.getQName())) { return desc; } } } return null; } /** * Returns the FaultDesc for an XMLType. * Returns null if not found. */ public FaultDesc getFaultByXmlType(QName xmlType) { if (faults != null) { for (Iterator iterator = faults.iterator(); iterator.hasNext();) { FaultDesc desc = (FaultDesc) iterator.next(); if (xmlType.equals(desc.getXmlType())) { return desc; } } } return null; } public ParameterDesc getReturnParamDesc() { return returnDesc; } public String toString() { return toString(""); } public String toString(String indent) { String text =""; text+=indent+"name: " + getName() + "\n"; text+=indent+"returnQName: " + getReturnQName() + "\n"; text+=indent+"returnType: " + getReturnType() + "\n"; text+=indent+"returnClass: " + getReturnClass() + "\n"; text+=indent+"elementQName:" + getElementQName() + "\n"; text+=indent+"soapAction: " + getSoapAction() + "\n"; text+=indent+"style: " + getStyle().getName() + "\n"; text+=indent+"use: " + getUse().getName() + "\n"; text+=indent+"numInParams: " + getNumInParams() + "\n"; text+=indent+"method:" + getMethod() + "\n"; for (int i=0; i<parameters.size(); i++) { text+=indent+" ParameterDesc[" + i + "]:\n"; text+=indent+ ((ParameterDesc)parameters.get(i)).toString(" ") + "\n"; } if (faults != null) { for (int i=0; i<faults.size(); i++) { text+=indent+" FaultDesc[" + i + "]:\n"; text+=indent+ ((FaultDesc)faults.get(i)).toString(" ") + "\n"; } } return text; } public int getMessageOperationStyle() { return messageOperationStyle; } public void setMessageOperationStyle(int messageOperationStyle) { this.messageOperationStyle = messageOperationStyle; } public OperationType getMep() { return mep; } public void setMep(OperationType mep) { this.mep = mep; } /** * Set the MEP using a string like "request-response" * @param mepString */ public void setMep(String mepString) { OperationType newMep = (OperationType)mepStrings.get(mepString); if (newMep != null) { mep = newMep; } } private void writeObject(java.io.ObjectOutputStream out) throws IOException { out.defaultWriteObject(); if (method != null){ out.writeObject(method.getDeclaringClass()); out.writeObject(method.getName()); out.writeObject(method.getParameterTypes()); } else { out.writeObject(null); } } private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException{ in.defaultReadObject(); Class clazz = (Class) in.readObject(); if (clazz != null){ String methodName = (String) in.readObject(); Class[] parameterTypes = (Class[]) in.readObject(); try { method = clazz.getMethod(methodName, parameterTypes); } catch (NoSuchMethodException e) { throw new IOException("Unable to deserialize the operation's method: "+ methodName); } } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -