parameterdescriptionimpl.java
来自「开源的axis2框架的源码。用于开发WEBSERVER」· Java 代码 · 共 423 行 · 第 1/2 页
JAVA
423 行
/** Answer whether this ParameterDescription represents a JAX-WS Holder<T> type. */
public boolean isHolderType() {
// If this is a JAX-WS Holder<T> type, then we set the the class of the actual
// parameter <T> in the constructor. Otherwise, that is null.
// Holder types are defined by JSR-224 JAX-WS 2.0, Sec 2.3.3, pg 16
if (paramDescComposite != null) {
return paramDescComposite.isHolderType();
} else {
return Holder.class.equals(getParameterType());
}
}
// =====================================
// ANNOTATION: WebParam
// =====================================
public WebParam getAnnoWebParam() {
return webParamAnnotation;
}
public String getParameterName() {
// REVIEW: WSDL/Anno merge
return getAnnoWebParamName();
}
public String getAnnoWebParamName() {
if (webParamName == null) {
if (getAnnoWebParam() != null && !DescriptionUtils.isEmpty(getAnnoWebParam().name())) {
webParamName = getAnnoWebParam().name();
} else if (getOperationDescription().getSoapBindingStyle() == SOAPBinding.Style.DOCUMENT
&& getOperationDescription().getSoapBindingParameterStyle() ==
SOAPBinding.ParameterStyle.BARE) {
// Defaul per JSR-181 MR Sec 4.4.1, pg 19
// TODO: Validation: For BARE paramaterUse, only a single IN our INOUT paramater and a single output (either return or OUT or INOUT) is allowed
// Per JSR-224, Sec 3.6.2.2, pg 37
webParamName = getOperationDescription().getOperationName();
} else {
// Default per JSR-181 MR Sec 4.4.1, pg 20
// Return "argN" where N is the index of the parameter in the method signature
webParamName = "arg" + parameterNumber;
}
}
return webParamName;
}
public String getPartName() {
// REVIEW: WSDL/Anno merge
return getAnnoWebParamPartName();
}
public String getAnnoWebParamPartName() {
if (webParamPartName == null) {
if (getAnnoWebParam() != null &&
!DescriptionUtils.isEmpty(getAnnoWebParam().partName())) {
webParamPartName = getAnnoWebParam().partName();
} else {
// Default per JSR-181 MR Sec 4.4.1, pg 20
webParamPartName = getAnnoWebParamName();
}
}
return webParamPartName;
}
public String getTargetNamespace() {
// REVIEW: WSDL/Anno merge
return getAnnoWebParamTargetNamespace();
}
public String getAnnoWebParamTargetNamespace() {
if (webParamTargetNamespace == null) {
if (getAnnoWebParam() != null &&
!DescriptionUtils.isEmpty(getAnnoWebParam().targetNamespace())) {
webParamTargetNamespace = getAnnoWebParam().targetNamespace();
} else if (getOperationDescription().getSoapBindingStyle() == SOAPBinding.Style.DOCUMENT
&& getOperationDescription().getSoapBindingParameterStyle() ==
SOAPBinding.ParameterStyle.WRAPPED
&& !getAnnoWebParamHeader()) {
// Defaul per JSR-181 MR Sec 4.4.1, pg 20
webParamTargetNamespace = WebParam_TargetNamespace_DEFAULT;
} else {
// Default per JSR-181 MR Sec 4.4.1, pg 20
webParamTargetNamespace = ((EndpointDescriptionJava)getOperationDescription()
.getEndpointInterfaceDescription().getEndpointDescription())
.getAnnoWebServiceTargetNamespace();
}
}
return webParamTargetNamespace;
}
// public Mode getMode() {
public WebParam.Mode getMode() {
// REVIEW: WSDL/Anno merge. Problem is that OpDesc is expecting WebParam.Mode
return getAnnoWebParamMode();
}
public WebParam.Mode getAnnoWebParamMode() {
if (webParamMode == null) {
// REVIEW: Is the following correct?
// Interesting conundrum here:
// Because WebParam.mode has a default value, it will always return something if the
// annotation is present. That value is currently Mode.IN. However, that default is only
// correct for a non-Holder Type; the correct default for a Holder Type is Mode.INOUT. Furthermore,
// there's no way (I can tell) to differentiate if the setting for mode() was specified or defaulted,
// so there's no way to tell if the value is defaulted to IN or explicitly specified IN by the annotation.
// The conundrum is: Do we return the value from the annotation, or do we return the default value based on the
// type. For now, for a Holder type that has a value of IN, we reset the value to INOUT.
// That means even if WebParam.mode=IN was explicitly set, it will be overridden to INOUT.
// The default values are from JSR-181 MR Sec 4.4.1, pg 20
// Unlike a String value, if the annotation is present, it will return a usable default value as defined by
// the Annotation. That is currently Mode.IN
if (getAnnoWebParam() != null) {
webParamMode = getAnnoWebParam().mode();
} else {
webParamMode = WebParam.Mode.IN;
}
if (isHolderType() && webParamMode == WebParam.Mode.IN) {
// Default per JSR-181 MR Sec 4.4.1, pg 20
webParamMode = WebParam.Mode.INOUT;
}
}
return webParamMode;
}
public boolean isHeader() {
// REVIEW: WSDL/Anno merge
return getAnnoWebParamHeader();
}
public boolean getAnnoWebParamHeader() {
if (webParamHeader == null) {
// Unlike a String value, if the annotation is present, it will return a usable default value.
if (getAnnoWebParam() != null) {
webParamHeader = getAnnoWebParam().header();
} else {
webParamHeader = WebParam_Header_DEFAULT;
}
}
return webParamHeader.booleanValue();
}
public String toString() {
final String newline = "\n";
final String sameline = "; ";
StringBuffer string = new StringBuffer();
try {
string.append(super.toString());
string.append(newline);
string.append("Name: " + getParameterName());
//
string.append(newline);
string.append("Is header: " + (isHeader() == true));
string.append(sameline);
string.append("Is holder: " + (isHolderType() == true));
//
string.append(newline);
string.append("Mode: " + getMode());
//
string.append(newline);
string.append("Type: " + getParameterType());
string.append(sameline);
string.append("Actual type: " + getParameterActualType());
if (getAttachmentDescription() != null) {
string.append(newline);
string.append(getAttachmentDescription().toString());
}
}
catch (Throwable t) {
string.append(newline);
string.append("Complete debug information not currently available for " +
"ParameterDescription");
return string.toString();
}
return string.toString();
}
public boolean isListType() {
return isListType;
}
/**
* Helper method to get to parent impl object.
*/
private OperationDescriptionImpl getOperationDescriptionImpl() {
if(this.getOperationDescription() instanceof OperationDescriptionImpl) {
return (OperationDescriptionImpl) this.getOperationDescription();
}
return null;
}
/**
* This method will return an AttachmentDescription based on the part name of the parameter.
*/
public AttachmentDescription getAttachmentDescription() {
String partName = this.getPartName();
if(partName != null && getOperationDescriptionImpl() != null) {
if(log.isDebugEnabled()) {
log.debug("Returning parameter AttachmentDescription for partName: " +
partName);
}
return getOperationDescriptionImpl().getPartAttachmentDescription(partName);
}
if(log.isDebugEnabled()) {
log.debug("Did not find parameter AttachmentDescription for partName: " + partName);
}
return null;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?