Java Code Examples for javax.jws.WebMethod#exclude()
The following examples show how to use
javax.jws.WebMethod#exclude() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WebServiceVisitor.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
protected boolean hasWebMethods(TypeElement element) { if (element.getQualifiedName().toString().equals(Object.class.getName())) return false; WebMethod webMethod; for (ExecutableElement method : ElementFilter.methodsIn(element.getEnclosedElements())) { webMethod = method.getAnnotation(WebMethod.class); if (webMethod != null) { if (webMethod.exclude()) { if (webMethod.operationName().length() > 0) builder.processError(WebserviceapMessages.WEBSERVICEAP_INVALID_WEBMETHOD_ELEMENT_WITH_EXCLUDE( "operationName", element.getQualifiedName(), method.toString()), method); if (webMethod.action().length() > 0) builder.processError(WebserviceapMessages.WEBSERVICEAP_INVALID_WEBMETHOD_ELEMENT_WITH_EXCLUDE( "action", element.getQualifiedName(), method.toString()), method); } else { return true; } } } return false;//hasWebMethods(d.getSuperclass().getDeclaration()); }
Example 2
Source File: WebServiceVisitor.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
protected boolean hasWebMethods(TypeElement element) { if (element.getQualifiedName().toString().equals(Object.class.getName())) return false; WebMethod webMethod; for (ExecutableElement method : ElementFilter.methodsIn(element.getEnclosedElements())) { webMethod = method.getAnnotation(WebMethod.class); if (webMethod != null) { if (webMethod.exclude()) { if (webMethod.operationName().length() > 0) builder.processError(WebserviceapMessages.WEBSERVICEAP_INVALID_WEBMETHOD_ELEMENT_WITH_EXCLUDE( "operationName", element.getQualifiedName(), method.toString()), method); if (webMethod.action().length() > 0) builder.processError(WebserviceapMessages.WEBSERVICEAP_INVALID_WEBMETHOD_ELEMENT_WITH_EXCLUDE( "action", element.getQualifiedName(), method.toString()), method); } else { return true; } } } return false;//hasWebMethods(d.getSuperclass().getDeclaration()); }
Example 3
Source File: WebServiceVisitor.java From hottub with GNU General Public License v2.0 | 6 votes |
protected boolean hasWebMethods(TypeElement element) { if (element.getQualifiedName().toString().equals(Object.class.getName())) return false; WebMethod webMethod; for (ExecutableElement method : ElementFilter.methodsIn(element.getEnclosedElements())) { webMethod = method.getAnnotation(WebMethod.class); if (webMethod != null) { if (webMethod.exclude()) { if (webMethod.operationName().length() > 0) builder.processError(WebserviceapMessages.WEBSERVICEAP_INVALID_WEBMETHOD_ELEMENT_WITH_EXCLUDE( "operationName", element.getQualifiedName(), method.toString()), method); if (webMethod.action().length() > 0) builder.processError(WebserviceapMessages.WEBSERVICEAP_INVALID_WEBMETHOD_ELEMENT_WITH_EXCLUDE( "action", element.getQualifiedName(), method.toString()), method); } else { return true; } } } return false;//hasWebMethods(d.getSuperclass().getDeclaration()); }
Example 4
Source File: WebServiceVisitor.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
protected boolean hasWebMethods(TypeElement element) { if (element.getQualifiedName().toString().equals(Object.class.getName())) return false; WebMethod webMethod; for (ExecutableElement method : ElementFilter.methodsIn(element.getEnclosedElements())) { webMethod = method.getAnnotation(WebMethod.class); if (webMethod != null) { if (webMethod.exclude()) { if (webMethod.operationName().length() > 0) builder.processError(WebserviceapMessages.WEBSERVICEAP_INVALID_WEBMETHOD_ELEMENT_WITH_EXCLUDE( "operationName", element.getQualifiedName(), method.toString()), method); if (webMethod.action().length() > 0) builder.processError(WebserviceapMessages.WEBSERVICEAP_INVALID_WEBMETHOD_ELEMENT_WITH_EXCLUDE( "action", element.getQualifiedName(), method.toString()), method); } else { return true; } } } return false;//hasWebMethods(d.getSuperclass().getDeclaration()); }
Example 5
Source File: WebServiceVisitor.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
protected boolean hasWebMethods(TypeElement element) { if (element.getQualifiedName().toString().equals(Object.class.getName())) return false; WebMethod webMethod; for (ExecutableElement method : ElementFilter.methodsIn(element.getEnclosedElements())) { webMethod = method.getAnnotation(WebMethod.class); if (webMethod != null) { if (webMethod.exclude()) { if (webMethod.operationName().length() > 0) builder.processError(WebserviceapMessages.WEBSERVICEAP_INVALID_WEBMETHOD_ELEMENT_WITH_EXCLUDE( "operationName", element.getQualifiedName(), method.toString()), method); if (webMethod.action().length() > 0) builder.processError(WebserviceapMessages.WEBSERVICEAP_INVALID_WEBMETHOD_ELEMENT_WITH_EXCLUDE( "action", element.getQualifiedName(), method.toString()), method); } else { return true; } } } return false;//hasWebMethods(d.getSuperclass().getDeclaration()); }
Example 6
Source File: WebServiceVisitor.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
protected boolean hasWebMethods(TypeElement element) { if (element.getQualifiedName().toString().equals(Object.class.getName())) return false; WebMethod webMethod; for (ExecutableElement method : ElementFilter.methodsIn(element.getEnclosedElements())) { webMethod = method.getAnnotation(WebMethod.class); if (webMethod != null) { if (webMethod.exclude()) { if (webMethod.operationName().length() > 0) builder.processError(WebserviceapMessages.WEBSERVICEAP_INVALID_WEBMETHOD_ELEMENT_WITH_EXCLUDE( "operationName", element.getQualifiedName(), method.toString()), method); if (webMethod.action().length() > 0) builder.processError(WebserviceapMessages.WEBSERVICEAP_INVALID_WEBMETHOD_ELEMENT_WITH_EXCLUDE( "action", element.getQualifiedName(), method.toString()), method); } else { return true; } } } return false;//hasWebMethods(d.getSuperclass().getDeclaration()); }
Example 7
Source File: WebServiceVisitor.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
@Override public Void visitExecutable(ExecutableElement method, Object o) { // Methods must be public if (!method.getModifiers().contains(Modifier.PUBLIC)) return null; if (processedMethod(method)) return null; WebMethod webMethod = method.getAnnotation(WebMethod.class); if (webMethod != null && webMethod.exclude()) return null; SOAPBinding soapBinding = method.getAnnotation(SOAPBinding.class); if (soapBinding == null && !method.getEnclosingElement().equals(typeElement)) { if (method.getEnclosingElement().getKind().equals(ElementKind.CLASS)) { soapBinding = method.getEnclosingElement().getAnnotation(SOAPBinding.class); if (soapBinding != null) builder.log("using " + method.getEnclosingElement() + "'s SOAPBinding."); else { soapBinding = new MySoapBinding(); } } } boolean newBinding = false; if (soapBinding != null) { newBinding = pushSoapBinding(soapBinding, method, typeElement); } try { if (shouldProcessMethod(method, webMethod)) { processMethod(method, webMethod); } } finally { if (newBinding) { popSoapBinding(); } } return null; }
Example 8
Source File: WebServiceVisitor.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
@Override public Void visitExecutable(ExecutableElement method, Object o) { // Methods must be public if (!method.getModifiers().contains(Modifier.PUBLIC)) return null; if (processedMethod(method)) return null; WebMethod webMethod = method.getAnnotation(WebMethod.class); if (webMethod != null && webMethod.exclude()) return null; SOAPBinding soapBinding = method.getAnnotation(SOAPBinding.class); if (soapBinding == null && !method.getEnclosingElement().equals(typeElement)) { if (method.getEnclosingElement().getKind().equals(ElementKind.CLASS)) { soapBinding = method.getEnclosingElement().getAnnotation(SOAPBinding.class); if (soapBinding != null) builder.log("using " + method.getEnclosingElement() + "'s SOAPBinding."); else { soapBinding = new MySoapBinding(); } } } boolean newBinding = false; if (soapBinding != null) { newBinding = pushSoapBinding(soapBinding, method, typeElement); } try { if (shouldProcessMethod(method, webMethod)) { processMethod(method, webMethod); } } finally { if (newBinding) { popSoapBinding(); } } return null; }
Example 9
Source File: WebServiceVisitor.java From hottub with GNU General Public License v2.0 | 5 votes |
@Override public Void visitExecutable(ExecutableElement method, Object o) { // Methods must be public if (!method.getModifiers().contains(Modifier.PUBLIC)) return null; if (processedMethod(method)) return null; WebMethod webMethod = method.getAnnotation(WebMethod.class); if (webMethod != null && webMethod.exclude()) return null; SOAPBinding soapBinding = method.getAnnotation(SOAPBinding.class); if (soapBinding == null && !method.getEnclosingElement().equals(typeElement)) { if (method.getEnclosingElement().getKind().equals(ElementKind.CLASS)) { soapBinding = method.getEnclosingElement().getAnnotation(SOAPBinding.class); if (soapBinding != null) builder.log("using " + method.getEnclosingElement() + "'s SOAPBinding."); else { soapBinding = new MySoapBinding(); } } } boolean newBinding = false; if (soapBinding != null) { newBinding = pushSoapBinding(soapBinding, method, typeElement); } try { if (shouldProcessMethod(method, webMethod)) { processMethod(method, webMethod); } } finally { if (newBinding) { popSoapBinding(); } } return null; }
Example 10
Source File: WebServiceVisitor.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
@Override public Void visitExecutable(ExecutableElement method, Object o) { // Methods must be public if (!method.getModifiers().contains(Modifier.PUBLIC)) return null; if (processedMethod(method)) return null; WebMethod webMethod = method.getAnnotation(WebMethod.class); if (webMethod != null && webMethod.exclude()) return null; SOAPBinding soapBinding = method.getAnnotation(SOAPBinding.class); if (soapBinding == null && !method.getEnclosingElement().equals(typeElement)) { if (method.getEnclosingElement().getKind().equals(ElementKind.CLASS)) { soapBinding = method.getEnclosingElement().getAnnotation(SOAPBinding.class); if (soapBinding != null) builder.log("using " + method.getEnclosingElement() + "'s SOAPBinding."); else { soapBinding = new MySoapBinding(); } } } boolean newBinding = false; if (soapBinding != null) { newBinding = pushSoapBinding(soapBinding, method, typeElement); } try { if (shouldProcessMethod(method, webMethod)) { processMethod(method, webMethod); } } finally { if (newBinding) { popSoapBinding(); } } return null; }
Example 11
Source File: JaxWsServiceConfiguration.java From cxf with Apache License 2.0 | 5 votes |
public Boolean isWebMethod(final Method method) { if (method == null || method.getReturnType().equals(Future.class) || method.getReturnType().equals(Response.class) || method.isSynthetic()) { return Boolean.FALSE; } WebMethod wm = method.getAnnotation(WebMethod.class); Class<?> cls = method.getDeclaringClass(); if ((wm != null) && wm.exclude()) { return Boolean.FALSE; } if ((wm != null && !wm.exclude()) || (implInfo.getSEIClass() != null && cls.isInterface() && cls.isAssignableFrom(implInfo.getSEIClass()))) { return Boolean.TRUE; } if (method.getDeclaringClass().isInterface()) { return hasWebServiceAnnotation(method); } if (implInfo.getSEIClass() == null) { return hasWebServiceAnnotation(method) && !Modifier.isFinal(method.getModifiers()) && !Modifier.isStatic(method.getModifiers()); } return implInfo.getSEIClass().isAssignableFrom(method.getDeclaringClass()); }
Example 12
Source File: WebServiceVisitor.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
@Override public Void visitExecutable(ExecutableElement method, Object o) { // Methods must be public if (!method.getModifiers().contains(Modifier.PUBLIC)) return null; if (processedMethod(method)) return null; WebMethod webMethod = method.getAnnotation(WebMethod.class); if (webMethod != null && webMethod.exclude()) return null; SOAPBinding soapBinding = method.getAnnotation(SOAPBinding.class); if (soapBinding == null && !method.getEnclosingElement().equals(typeElement)) { if (method.getEnclosingElement().getKind().equals(ElementKind.CLASS)) { soapBinding = method.getEnclosingElement().getAnnotation(SOAPBinding.class); if (soapBinding != null) builder.log("using " + method.getEnclosingElement() + "'s SOAPBinding."); else { soapBinding = new MySoapBinding(); } } } boolean newBinding = false; if (soapBinding != null) { newBinding = pushSoapBinding(soapBinding, method, typeElement); } try { if (shouldProcessMethod(method, webMethod)) { processMethod(method, webMethod); } } finally { if (newBinding) { popSoapBinding(); } } return null; }
Example 13
Source File: WebServiceVisitor.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
@Override public Void visitExecutable(ExecutableElement method, Object o) { // Methods must be public if (!method.getModifiers().contains(Modifier.PUBLIC)) return null; if (processedMethod(method)) return null; WebMethod webMethod = method.getAnnotation(WebMethod.class); if (webMethod != null && webMethod.exclude()) return null; SOAPBinding soapBinding = method.getAnnotation(SOAPBinding.class); if (soapBinding == null && !method.getEnclosingElement().equals(typeElement)) { if (method.getEnclosingElement().getKind().equals(ElementKind.CLASS)) { soapBinding = method.getEnclosingElement().getAnnotation(SOAPBinding.class); if (soapBinding != null) builder.log("using " + method.getEnclosingElement() + "'s SOAPBinding."); else { soapBinding = new MySoapBinding(); } } } boolean newBinding = false; if (soapBinding != null) { newBinding = pushSoapBinding(soapBinding, method, typeElement); } try { if (shouldProcessMethod(method, webMethod)) { processMethod(method, webMethod); } } finally { if (newBinding) { popSoapBinding(); } } return null; }
Example 14
Source File: WebServiceVisitor.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
protected boolean isLegalMethod(ExecutableElement method, TypeElement typeElement) { WebMethod webMethod = method.getAnnotation(WebMethod.class); //SEI cannot have methods with @WebMethod(exclude=true) if (typeElement.getKind().equals(ElementKind.INTERFACE) && webMethod != null && webMethod.exclude()) builder.processError(WebserviceapMessages.WEBSERVICEAP_INVALID_SEI_ANNOTATION_ELEMENT_EXCLUDE("exclude=true", typeElement.getQualifiedName(), method.toString()), method); // With https://jax-ws.dev.java.net/issues/show_bug.cgi?id=577, hasWebMethods has no effect if (hasWebMethods && webMethod == null) // backwards compatibility (for legacyWebMethod computation) return true; if ((webMethod != null) && webMethod.exclude()) { return true; } /* This check is not needed as Impl class is already checked that it is not abstract. if (typeElement instanceof TypeElement && method.getModifiers().contains(Modifier.ABSTRACT)) { // use Kind.equals instead of instanceOf builder.processError(method.getPosition(), WebserviceapMessages.WEBSERVICEAP_WEBSERVICE_METHOD_IS_ABSTRACT(typeElement.getQualifiedName(), method.getSimpleName())); return false; } */ TypeMirror returnType = method.getReturnType(); if (!isLegalType(returnType)) { builder.processError(WebserviceapMessages.WEBSERVICEAP_METHOD_RETURN_TYPE_CANNOT_IMPLEMENT_REMOTE(typeElement.getQualifiedName(), method.getSimpleName(), returnType), method); } boolean isOneWay = method.getAnnotation(Oneway.class) != null; if (isOneWay && !isValidOneWayMethod(method, typeElement)) return false; SOAPBinding soapBinding = method.getAnnotation(SOAPBinding.class); if (soapBinding != null) { if (soapBinding.style().equals(SOAPBinding.Style.RPC)) { builder.processError(WebserviceapMessages.WEBSERVICEAP_RPC_SOAPBINDING_NOT_ALLOWED_ON_METHOD(typeElement.getQualifiedName(), method.toString()), method); } } int paramIndex = 0; for (VariableElement parameter : method.getParameters()) { if (!isLegalParameter(parameter, method, typeElement, paramIndex++)) return false; } if (!isDocLitWrapped() && soapStyle.equals(SOAPStyle.DOCUMENT)) { VariableElement outParam = getOutParameter(method); int inParams = getModeParameterCount(method, WebParam.Mode.IN); int outParams = getModeParameterCount(method, WebParam.Mode.OUT); if (inParams != 1) { builder.processError(WebserviceapMessages.WEBSERVICEAP_DOC_BARE_AND_NO_ONE_IN(typeElement.getQualifiedName(), method.toString()), method); } if (returnType.accept(NO_TYPE_VISITOR, null)) { if (outParam == null && !isOneWay) { builder.processError(WebserviceapMessages.WEBSERVICEAP_DOC_BARE_NO_OUT(typeElement.getQualifiedName(), method.toString()), method); } if (outParams != 1) { if (!isOneWay && outParams != 0) builder.processError(WebserviceapMessages.WEBSERVICEAP_DOC_BARE_NO_RETURN_AND_NO_OUT(typeElement.getQualifiedName(), method.toString()), method); } } else { if (outParams > 0) { builder.processError(WebserviceapMessages.WEBSERVICEAP_DOC_BARE_RETURN_AND_OUT(typeElement.getQualifiedName(), method.toString()), outParam); } } } return true; }
Example 15
Source File: FrontendFactory.java From cxf with Apache License 2.0 | 4 votes |
private boolean isExcluced(Method method) { WebMethod webMethod = AnnotationUtil.getPrivMethodAnnotation(method, WebMethod.class); return webMethod != null && webMethod.exclude(); }
Example 16
Source File: WebServiceVisitor.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
protected boolean isLegalMethod(ExecutableElement method, TypeElement typeElement) { WebMethod webMethod = method.getAnnotation(WebMethod.class); //SEI cannot have methods with @WebMethod(exclude=true) if (typeElement.getKind().equals(ElementKind.INTERFACE) && webMethod != null && webMethod.exclude()) builder.processError(WebserviceapMessages.WEBSERVICEAP_INVALID_SEI_ANNOTATION_ELEMENT_EXCLUDE("exclude=true", typeElement.getQualifiedName(), method.toString()), method); // With https://jax-ws.dev.java.net/issues/show_bug.cgi?id=577, hasWebMethods has no effect if (hasWebMethods && webMethod == null) // backwards compatibility (for legacyWebMethod computation) return true; if ((webMethod != null) && webMethod.exclude()) { return true; } /* This check is not needed as Impl class is already checked that it is not abstract. if (typeElement instanceof TypeElement && method.getModifiers().contains(Modifier.ABSTRACT)) { // use Kind.equals instead of instanceOf builder.processError(method.getPosition(), WebserviceapMessages.WEBSERVICEAP_WEBSERVICE_METHOD_IS_ABSTRACT(typeElement.getQualifiedName(), method.getSimpleName())); return false; } */ TypeMirror returnType = method.getReturnType(); if (!isLegalType(returnType)) { builder.processError(WebserviceapMessages.WEBSERVICEAP_METHOD_RETURN_TYPE_CANNOT_IMPLEMENT_REMOTE(typeElement.getQualifiedName(), method.getSimpleName(), returnType), method); } boolean isOneWay = method.getAnnotation(Oneway.class) != null; if (isOneWay && !isValidOneWayMethod(method, typeElement)) return false; SOAPBinding soapBinding = method.getAnnotation(SOAPBinding.class); if (soapBinding != null) { if (soapBinding.style().equals(SOAPBinding.Style.RPC)) { builder.processError(WebserviceapMessages.WEBSERVICEAP_RPC_SOAPBINDING_NOT_ALLOWED_ON_METHOD(typeElement.getQualifiedName(), method.toString()), method); } } int paramIndex = 0; for (VariableElement parameter : method.getParameters()) { if (!isLegalParameter(parameter, method, typeElement, paramIndex++)) return false; } if (!isDocLitWrapped() && soapStyle.equals(SOAPStyle.DOCUMENT)) { VariableElement outParam = getOutParameter(method); int inParams = getModeParameterCount(method, WebParam.Mode.IN); int outParams = getModeParameterCount(method, WebParam.Mode.OUT); if (inParams != 1) { builder.processError(WebserviceapMessages.WEBSERVICEAP_DOC_BARE_AND_NO_ONE_IN(typeElement.getQualifiedName(), method.toString()), method); } if (returnType.accept(NO_TYPE_VISITOR, null)) { if (outParam == null && !isOneWay) { builder.processError(WebserviceapMessages.WEBSERVICEAP_DOC_BARE_NO_OUT(typeElement.getQualifiedName(), method.toString()), method); } if (outParams != 1) { if (!isOneWay && outParams != 0) builder.processError(WebserviceapMessages.WEBSERVICEAP_DOC_BARE_NO_RETURN_AND_NO_OUT(typeElement.getQualifiedName(), method.toString()), method); } } else { if (outParams > 0) { builder.processError(WebserviceapMessages.WEBSERVICEAP_DOC_BARE_RETURN_AND_OUT(typeElement.getQualifiedName(), method.toString()), outParam); } } } return true; }
Example 17
Source File: WebServiceVisitor.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
protected boolean isLegalMethod(ExecutableElement method, TypeElement typeElement) { WebMethod webMethod = method.getAnnotation(WebMethod.class); //SEI cannot have methods with @WebMethod(exclude=true) if (typeElement.getKind().equals(ElementKind.INTERFACE) && webMethod != null && webMethod.exclude()) builder.processError(WebserviceapMessages.WEBSERVICEAP_INVALID_SEI_ANNOTATION_ELEMENT_EXCLUDE("exclude=true", typeElement.getQualifiedName(), method.toString()), method); // With https://jax-ws.dev.java.net/issues/show_bug.cgi?id=577, hasWebMethods has no effect if (hasWebMethods && webMethod == null) // backwards compatibility (for legacyWebMethod computation) return true; if ((webMethod != null) && webMethod.exclude()) { return true; } /* This check is not needed as Impl class is already checked that it is not abstract. if (typeElement instanceof TypeElement && method.getModifiers().contains(Modifier.ABSTRACT)) { // use Kind.equals instead of instanceOf builder.processError(method.getPosition(), WebserviceapMessages.WEBSERVICEAP_WEBSERVICE_METHOD_IS_ABSTRACT(typeElement.getQualifiedName(), method.getSimpleName())); return false; } */ TypeMirror returnType = method.getReturnType(); if (!isLegalType(returnType)) { builder.processError(WebserviceapMessages.WEBSERVICEAP_METHOD_RETURN_TYPE_CANNOT_IMPLEMENT_REMOTE(typeElement.getQualifiedName(), method.getSimpleName(), returnType), method); } boolean isOneWay = method.getAnnotation(Oneway.class) != null; if (isOneWay && !isValidOneWayMethod(method, typeElement)) return false; SOAPBinding soapBinding = method.getAnnotation(SOAPBinding.class); if (soapBinding != null) { if (soapBinding.style().equals(SOAPBinding.Style.RPC)) { builder.processError(WebserviceapMessages.WEBSERVICEAP_RPC_SOAPBINDING_NOT_ALLOWED_ON_METHOD(typeElement.getQualifiedName(), method.toString()), method); } } int paramIndex = 0; for (VariableElement parameter : method.getParameters()) { if (!isLegalParameter(parameter, method, typeElement, paramIndex++)) return false; } if (!isDocLitWrapped() && soapStyle.equals(SOAPStyle.DOCUMENT)) { VariableElement outParam = getOutParameter(method); int inParams = getModeParameterCount(method, WebParam.Mode.IN); int outParams = getModeParameterCount(method, WebParam.Mode.OUT); if (inParams != 1) { builder.processError(WebserviceapMessages.WEBSERVICEAP_DOC_BARE_AND_NO_ONE_IN(typeElement.getQualifiedName(), method.toString()), method); } if (returnType.accept(NO_TYPE_VISITOR, null)) { if (outParam == null && !isOneWay) { builder.processError(WebserviceapMessages.WEBSERVICEAP_DOC_BARE_NO_OUT(typeElement.getQualifiedName(), method.toString()), method); } if (outParams != 1) { if (!isOneWay && outParams != 0) builder.processError(WebserviceapMessages.WEBSERVICEAP_DOC_BARE_NO_RETURN_AND_NO_OUT(typeElement.getQualifiedName(), method.toString()), method); } } else { if (outParams > 0) { builder.processError(WebserviceapMessages.WEBSERVICEAP_DOC_BARE_RETURN_AND_OUT(typeElement.getQualifiedName(), method.toString()), outParam); } } } return true; }
Example 18
Source File: WebServiceVisitor.java From hottub with GNU General Public License v2.0 | 4 votes |
protected boolean isLegalMethod(ExecutableElement method, TypeElement typeElement) { WebMethod webMethod = method.getAnnotation(WebMethod.class); //SEI cannot have methods with @WebMethod(exclude=true) if (typeElement.getKind().equals(ElementKind.INTERFACE) && webMethod != null && webMethod.exclude()) builder.processError(WebserviceapMessages.WEBSERVICEAP_INVALID_SEI_ANNOTATION_ELEMENT_EXCLUDE("exclude=true", typeElement.getQualifiedName(), method.toString()), method); // With https://jax-ws.dev.java.net/issues/show_bug.cgi?id=577, hasWebMethods has no effect if (hasWebMethods && webMethod == null) // backwards compatibility (for legacyWebMethod computation) return true; if ((webMethod != null) && webMethod.exclude()) { return true; } /* This check is not needed as Impl class is already checked that it is not abstract. if (typeElement instanceof TypeElement && method.getModifiers().contains(Modifier.ABSTRACT)) { // use Kind.equals instead of instanceOf builder.processError(method.getPosition(), WebserviceapMessages.WEBSERVICEAP_WEBSERVICE_METHOD_IS_ABSTRACT(typeElement.getQualifiedName(), method.getSimpleName())); return false; } */ TypeMirror returnType = method.getReturnType(); if (!isLegalType(returnType)) { builder.processError(WebserviceapMessages.WEBSERVICEAP_METHOD_RETURN_TYPE_CANNOT_IMPLEMENT_REMOTE(typeElement.getQualifiedName(), method.getSimpleName(), returnType), method); } boolean isOneWay = method.getAnnotation(Oneway.class) != null; if (isOneWay && !isValidOneWayMethod(method, typeElement)) return false; SOAPBinding soapBinding = method.getAnnotation(SOAPBinding.class); if (soapBinding != null) { if (soapBinding.style().equals(SOAPBinding.Style.RPC)) { builder.processError(WebserviceapMessages.WEBSERVICEAP_RPC_SOAPBINDING_NOT_ALLOWED_ON_METHOD(typeElement.getQualifiedName(), method.toString()), method); } } int paramIndex = 0; for (VariableElement parameter : method.getParameters()) { if (!isLegalParameter(parameter, method, typeElement, paramIndex++)) return false; } if (!isDocLitWrapped() && soapStyle.equals(SOAPStyle.DOCUMENT)) { VariableElement outParam = getOutParameter(method); int inParams = getModeParameterCount(method, WebParam.Mode.IN); int outParams = getModeParameterCount(method, WebParam.Mode.OUT); if (inParams != 1) { builder.processError(WebserviceapMessages.WEBSERVICEAP_DOC_BARE_AND_NO_ONE_IN(typeElement.getQualifiedName(), method.toString()), method); } if (returnType.accept(NO_TYPE_VISITOR, null)) { if (outParam == null && !isOneWay) { builder.processError(WebserviceapMessages.WEBSERVICEAP_DOC_BARE_NO_OUT(typeElement.getQualifiedName(), method.toString()), method); } if (outParams != 1) { if (!isOneWay && outParams != 0) builder.processError(WebserviceapMessages.WEBSERVICEAP_DOC_BARE_NO_RETURN_AND_NO_OUT(typeElement.getQualifiedName(), method.toString()), method); } } else { if (outParams > 0) { builder.processError(WebserviceapMessages.WEBSERVICEAP_DOC_BARE_RETURN_AND_OUT(typeElement.getQualifiedName(), method.toString()), outParam); } } } return true; }
Example 19
Source File: WebServiceVisitor.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
protected boolean isLegalMethod(ExecutableElement method, TypeElement typeElement) { WebMethod webMethod = method.getAnnotation(WebMethod.class); //SEI cannot have methods with @WebMethod(exclude=true) if (typeElement.getKind().equals(ElementKind.INTERFACE) && webMethod != null && webMethod.exclude()) builder.processError(WebserviceapMessages.WEBSERVICEAP_INVALID_SEI_ANNOTATION_ELEMENT_EXCLUDE("exclude=true", typeElement.getQualifiedName(), method.toString()), method); // With https://jax-ws.dev.java.net/issues/show_bug.cgi?id=577, hasWebMethods has no effect if (hasWebMethods && webMethod == null) // backwards compatibility (for legacyWebMethod computation) return true; if ((webMethod != null) && webMethod.exclude()) { return true; } /* This check is not needed as Impl class is already checked that it is not abstract. if (typeElement instanceof TypeElement && method.getModifiers().contains(Modifier.ABSTRACT)) { // use Kind.equals instead of instanceOf builder.processError(method.getPosition(), WebserviceapMessages.WEBSERVICEAP_WEBSERVICE_METHOD_IS_ABSTRACT(typeElement.getQualifiedName(), method.getSimpleName())); return false; } */ TypeMirror returnType = method.getReturnType(); if (!isLegalType(returnType)) { builder.processError(WebserviceapMessages.WEBSERVICEAP_METHOD_RETURN_TYPE_CANNOT_IMPLEMENT_REMOTE(typeElement.getQualifiedName(), method.getSimpleName(), returnType), method); } boolean isOneWay = method.getAnnotation(Oneway.class) != null; if (isOneWay && !isValidOneWayMethod(method, typeElement)) return false; SOAPBinding soapBinding = method.getAnnotation(SOAPBinding.class); if (soapBinding != null) { if (soapBinding.style().equals(SOAPBinding.Style.RPC)) { builder.processError(WebserviceapMessages.WEBSERVICEAP_RPC_SOAPBINDING_NOT_ALLOWED_ON_METHOD(typeElement.getQualifiedName(), method.toString()), method); } } int paramIndex = 0; for (VariableElement parameter : method.getParameters()) { if (!isLegalParameter(parameter, method, typeElement, paramIndex++)) return false; } if (!isDocLitWrapped() && soapStyle.equals(SOAPStyle.DOCUMENT)) { VariableElement outParam = getOutParameter(method); int inParams = getModeParameterCount(method, WebParam.Mode.IN); int outParams = getModeParameterCount(method, WebParam.Mode.OUT); if (inParams != 1) { builder.processError(WebserviceapMessages.WEBSERVICEAP_DOC_BARE_AND_NO_ONE_IN(typeElement.getQualifiedName(), method.toString()), method); } if (returnType.accept(NO_TYPE_VISITOR, null)) { if (outParam == null && !isOneWay) { builder.processError(WebserviceapMessages.WEBSERVICEAP_DOC_BARE_NO_OUT(typeElement.getQualifiedName(), method.toString()), method); } if (outParams != 1) { if (!isOneWay && outParams != 0) builder.processError(WebserviceapMessages.WEBSERVICEAP_DOC_BARE_NO_RETURN_AND_NO_OUT(typeElement.getQualifiedName(), method.toString()), method); } } else { if (outParams > 0) { builder.processError(WebserviceapMessages.WEBSERVICEAP_DOC_BARE_RETURN_AND_OUT(typeElement.getQualifiedName(), method.toString()), outParam); } } } return true; }
Example 20
Source File: WebServiceVisitor.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
protected boolean isLegalMethod(ExecutableElement method, TypeElement typeElement) { WebMethod webMethod = method.getAnnotation(WebMethod.class); //SEI cannot have methods with @WebMethod(exclude=true) if (typeElement.getKind().equals(ElementKind.INTERFACE) && webMethod != null && webMethod.exclude()) builder.processError(WebserviceapMessages.WEBSERVICEAP_INVALID_SEI_ANNOTATION_ELEMENT_EXCLUDE("exclude=true", typeElement.getQualifiedName(), method.toString()), method); // With https://jax-ws.dev.java.net/issues/show_bug.cgi?id=577, hasWebMethods has no effect if (hasWebMethods && webMethod == null) // backwards compatibility (for legacyWebMethod computation) return true; if ((webMethod != null) && webMethod.exclude()) { return true; } /* This check is not needed as Impl class is already checked that it is not abstract. if (typeElement instanceof TypeElement && method.getModifiers().contains(Modifier.ABSTRACT)) { // use Kind.equals instead of instanceOf builder.processError(method.getPosition(), WebserviceapMessages.WEBSERVICEAP_WEBSERVICE_METHOD_IS_ABSTRACT(typeElement.getQualifiedName(), method.getSimpleName())); return false; } */ TypeMirror returnType = method.getReturnType(); if (!isLegalType(returnType)) { builder.processError(WebserviceapMessages.WEBSERVICEAP_METHOD_RETURN_TYPE_CANNOT_IMPLEMENT_REMOTE(typeElement.getQualifiedName(), method.getSimpleName(), returnType), method); } boolean isOneWay = method.getAnnotation(Oneway.class) != null; if (isOneWay && !isValidOneWayMethod(method, typeElement)) return false; SOAPBinding soapBinding = method.getAnnotation(SOAPBinding.class); if (soapBinding != null) { if (soapBinding.style().equals(SOAPBinding.Style.RPC)) { builder.processError(WebserviceapMessages.WEBSERVICEAP_RPC_SOAPBINDING_NOT_ALLOWED_ON_METHOD(typeElement.getQualifiedName(), method.toString()), method); } } int paramIndex = 0; for (VariableElement parameter : method.getParameters()) { if (!isLegalParameter(parameter, method, typeElement, paramIndex++)) return false; } if (!isDocLitWrapped() && soapStyle.equals(SOAPStyle.DOCUMENT)) { VariableElement outParam = getOutParameter(method); int inParams = getModeParameterCount(method, WebParam.Mode.IN); int outParams = getModeParameterCount(method, WebParam.Mode.OUT); if (inParams != 1) { builder.processError(WebserviceapMessages.WEBSERVICEAP_DOC_BARE_AND_NO_ONE_IN(typeElement.getQualifiedName(), method.toString()), method); } if (returnType.accept(NO_TYPE_VISITOR, null)) { if (outParam == null && !isOneWay) { builder.processError(WebserviceapMessages.WEBSERVICEAP_DOC_BARE_NO_OUT(typeElement.getQualifiedName(), method.toString()), method); } if (outParams != 1) { if (!isOneWay && outParams != 0) builder.processError(WebserviceapMessages.WEBSERVICEAP_DOC_BARE_NO_RETURN_AND_NO_OUT(typeElement.getQualifiedName(), method.toString()), method); } } else { if (outParams > 0) { builder.processError(WebserviceapMessages.WEBSERVICEAP_DOC_BARE_RETURN_AND_OUT(typeElement.getQualifiedName(), method.toString()), outParam); } } } return true; }