本文整理匯總了Java中javax.xml.ws.WebFault.faultBean方法的典型用法代碼示例。如果您正苦於以下問題:Java WebFault.faultBean方法的具體用法?Java WebFault.faultBean怎麽用?Java WebFault.faultBean使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.xml.ws.WebFault
的用法示例。
在下文中一共展示了WebFault.faultBean方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getFaultBean
import javax.xml.ws.WebFault; //導入方法依賴的package包/類
public String getFaultBean() {
if (faultBean != null && faultBean.length() > 0) {
// Return the faultBean if it was already calculated
return faultBean;
} else {
// Load up the WebFault annotation and get the faultBean.
// @WebFault may not be present
WebFault annotation = getAnnoWebFault();
if (annotation != null && annotation.faultBean() != null &&
annotation.faultBean().length() > 0) {
faultBean = annotation.faultBean();
} else {
// There is no default. But it seems reasonable to return
// the fault info type.
faultBean = getFaultInfo();
// The faultBean still may be "" at this point. The JAXWS runtime
// is responsible for finding/buildin a representative fault bean.
}
}
return faultBean;
}
示例2: generateExceptionBean
import javax.xml.ws.WebFault; //導入方法依賴的package包/類
private boolean generateExceptionBean(TypeElement thrownDecl, String beanPackage) {
if (!builder.isServiceException(thrownDecl.asType()))
return false;
String exceptionName = ClassNameInfo.getName(thrownDecl.getQualifiedName().toString());
if (processedExceptions.contains(exceptionName))
return false;
processedExceptions.add(exceptionName);
WebFault webFault = thrownDecl.getAnnotation(WebFault.class);
String className = beanPackage+ exceptionName + BEAN.getValue();
Collection<MemberInfo> members = ap_generator.collectExceptionBeanMembers(thrownDecl);
boolean isWSDLException = isWSDLException(members, thrownDecl);
String namespace = typeNamespace;
String name = exceptionName;
FaultInfo faultInfo;
if (isWSDLException) {
TypeMirror beanType = getFaultInfoMember(members).getParamType();
faultInfo = new FaultInfo(TypeMonikerFactory.getTypeMoniker(beanType), true);
namespace = webFault.targetNamespace().length()>0 ?
webFault.targetNamespace() : namespace;
name = webFault.name().length()>0 ?
webFault.name() : name;
faultInfo.setElementName(new QName(namespace, name));
seiContext.addExceptionBeanEntry(thrownDecl.getQualifiedName(), faultInfo, builder);
return false;
}
if (webFault != null) {
namespace = webFault.targetNamespace().length()>0 ?
webFault.targetNamespace() : namespace;
name = webFault.name().length()>0 ?
webFault.name() : name;
className = webFault.faultBean().length()>0 ?
webFault.faultBean() : className;
}
JDefinedClass cls = getCMClass(className, CLASS);
faultInfo = new FaultInfo(className, false);
if (duplicateName(className)) {
builder.processError(WebserviceapMessages.WEBSERVICEAP_METHOD_EXCEPTION_BEAN_NAME_NOT_UNIQUE(
typeElement.getQualifiedName(), thrownDecl.getQualifiedName()));
}
boolean canOverWriteBean = builder.canOverWriteClass(className);
if (!canOverWriteBean) {
builder.log("Class " + className + " exists. Not overwriting.");
seiContext.addExceptionBeanEntry(thrownDecl.getQualifiedName(), faultInfo, builder);
return false;
}
if (seiContext.getExceptionBeanName(thrownDecl.getQualifiedName()) != null)
return false;
//write class comment - JAXWS warning
JDocComment comment = cls.javadoc();
for (String doc : GeneratorBase.getJAXWSClassComment(ToolVersion.VERSION.MAJOR_VERSION)) {
comment.add(doc);
}
// XmlElement Declarations
writeXmlElementDeclaration(cls, name, namespace);
// XmlType Declaration
//members = sortMembers(members);
XmlType xmlType = thrownDecl.getAnnotation(XmlType.class);
String xmlTypeName = (xmlType != null && !xmlType.name().equals("##default")) ? xmlType.name() : exceptionName;
String xmlTypeNamespace = (xmlType != null && !xmlType.namespace().equals("##default")) ? xmlType.namespace() : typeNamespace;
writeXmlTypeDeclaration(cls, xmlTypeName, xmlTypeNamespace, members);
writeMembers(cls, members);
seiContext.addExceptionBeanEntry(thrownDecl.getQualifiedName(), faultInfo, builder);
return true;
}
示例3: generateExceptionBean
import javax.xml.ws.WebFault; //導入方法依賴的package包/類
private boolean generateExceptionBean(TypeElement thrownDecl, String beanPackage) {
if (!builder.isServiceException(thrownDecl.asType()))
return false;
String exceptionName = ClassNameInfo.getName(thrownDecl.getQualifiedName().toString());
if (processedExceptions.contains(exceptionName))
return false;
processedExceptions.add(exceptionName);
WebFault webFault = thrownDecl.getAnnotation(WebFault.class);
String className = beanPackage+ exceptionName + BEAN.getValue();
Collection<MemberInfo> members = ap_generator.collectExceptionBeanMembers(thrownDecl);
boolean isWSDLException = isWSDLException(members, thrownDecl);
String namespace = typeNamespace;
String name = exceptionName;
FaultInfo faultInfo;
if (isWSDLException) {
TypeMirror beanType = getFaultInfoMember(members).getParamType();
faultInfo = new FaultInfo(TypeMonikerFactory.getTypeMoniker(beanType), true);
namespace = webFault.targetNamespace().length()>0 ?
webFault.targetNamespace() : namespace;
name = webFault.name().length()>0 ?
webFault.name() : name;
faultInfo.setElementName(new QName(namespace, name));
seiContext.addExceptionBeanEntry(thrownDecl.getQualifiedName(), faultInfo, builder);
return false;
}
if (webFault != null) {
namespace = webFault.targetNamespace().length()>0 ?
webFault.targetNamespace() : namespace;
name = webFault.name().length()>0 ?
webFault.name() : name;
className = webFault.faultBean().length()>0 ?
webFault.faultBean() : className;
}
JDefinedClass cls = getCMClass(className, CLASS);
faultInfo = new FaultInfo(className, false);
if (duplicateName(className)) {
builder.processError(WebserviceapMessages.WEBSERVICEAP_METHOD_EXCEPTION_BEAN_NAME_NOT_UNIQUE(
typeElement.getQualifiedName(), thrownDecl.getQualifiedName()));
}
boolean canOverWriteBean = builder.canOverWriteClass(className);
if (!canOverWriteBean) {
builder.log("Class " + className + " exists. Not overwriting.");
seiContext.addExceptionBeanEntry(thrownDecl.getQualifiedName(), faultInfo, builder);
return false;
}
if (seiContext.getExceptionBeanName(thrownDecl.getQualifiedName()) != null) {
return false;
}
addGeneratedFile(className);
//write class comment - JAXWS warning
JDocComment comment = cls.javadoc();
for (String doc : GeneratorBase.getJAXWSClassComment(ToolVersion.VERSION.MAJOR_VERSION)) {
comment.add(doc);
}
// XmlElement Declarations
writeXmlElementDeclaration(cls, name, namespace);
// XmlType Declaration
//members = sortMembers(members);
XmlType xmlType = thrownDecl.getAnnotation(XmlType.class);
String xmlTypeName = (xmlType != null && !xmlType.name().equals("##default")) ? xmlType.name() : exceptionName;
String xmlTypeNamespace = (xmlType != null && !xmlType.namespace().equals("##default")) ? xmlType.namespace() : typeNamespace;
writeXmlTypeDeclaration(cls, xmlTypeName, xmlTypeNamespace, members);
writeMembers(cls, members);
seiContext.addExceptionBeanEntry(thrownDecl.getQualifiedName(), faultInfo, builder);
return true;
}
示例4: generateExceptionBean
import javax.xml.ws.WebFault; //導入方法依賴的package包/類
private boolean generateExceptionBean(ClassDeclaration thrownDecl, String beanPackage) {
if (!builder.isServiceException(thrownDecl))
return false;
String exceptionName = ClassNameInfo.getName(thrownDecl.getQualifiedName());
if (processedExceptions.contains(exceptionName))
return false;
processedExceptions.add(exceptionName);
WebFault webFault = thrownDecl.getAnnotation(WebFault.class);
String className = beanPackage+ exceptionName + BEAN;
Collection<MemberInfo> members = APT_GENERATOR.collectExceptionBeanMembers(thrownDecl);
boolean isWSDLException = isWSDLException(members, thrownDecl);
String namespace = typeNamespace;
String name = exceptionName;
FaultInfo faultInfo;
if (isWSDLException) {
TypeMirror beanType = getFaultInfoMember(members).getParamType();
faultInfo = new FaultInfo(TypeMonikerFactory.getTypeMoniker(beanType), true);
namespace = webFault.targetNamespace().length()>0 ?
webFault.targetNamespace() : namespace;
name = webFault.name().length()>0 ?
webFault.name() : name;
faultInfo.setElementName(new QName(namespace, name));
seiContext.addExceptionBeanEntry(thrownDecl.getQualifiedName(), faultInfo, builder);
return false;
}
if (webFault != null) {
namespace = webFault.targetNamespace().length()>0 ?
webFault.targetNamespace() : namespace;
name = webFault.name().length()>0 ?
webFault.name() : name;
className = webFault.faultBean().length()>0 ?
webFault.faultBean() : className;
}
JDefinedClass cls = getCMClass(className, CLASS);
faultInfo = new FaultInfo(className, false);
if (duplicateName(className)) {
builder.onError(WebserviceapMessages.WEBSERVICEAP_METHOD_EXCEPTION_BEAN_NAME_NOT_UNIQUE(typeDecl.getQualifiedName(), thrownDecl.getQualifiedName()));
}
boolean canOverWriteBean = builder.canOverWriteClass(className);
if (!canOverWriteBean) {
builder.log("Class " + className + " exists. Not overwriting.");
seiContext.addExceptionBeanEntry(thrownDecl.getQualifiedName(), faultInfo, builder);
return false;
}
if (seiContext.getExceptionBeanName(thrownDecl.getQualifiedName()) != null)
return false;
//write class comment - JAXWS warning
JDocComment comment = cls.javadoc();
for (String doc : GeneratorBase.getJAXWSClassComment(builder.getSourceVersion())) {
comment.add(doc);
}
// XmlElement Declarations
writeXmlElementDeclaration(cls, name, namespace);
// XmlType Declaration
//members = sortMembers(members);
XmlType xmlType = thrownDecl.getAnnotation(XmlType.class);
String xmlTypeName = (xmlType != null && !xmlType.name().equals("##default")) ? xmlType.name() : exceptionName;
String xmlTypeNamespace = (xmlType != null && !xmlType.namespace().equals("##default")) ? xmlType.namespace() : typeNamespace;
writeXmlTypeDeclaration(cls, xmlTypeName, xmlTypeNamespace, members);
writeMembers(cls, members);
seiContext.addExceptionBeanEntry(thrownDecl.getQualifiedName(), faultInfo, builder);
return true;
}