Java Code Examples for javax.lang.model.element.TypeElement#accept()

The following examples show how to use javax.lang.model.element.TypeElement#accept() . 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: WebServiceAp.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
    if (context.getRound() != 1) {
        return true;
    }
    context.incrementRound();
    WebService webService;
    WebServiceProvider webServiceProvider;
    WebServiceVisitor webServiceVisitor = new WebServiceWrapperGenerator(this, context);
    boolean processedEndpoint = false;
    Collection<TypeElement> classes = new ArrayList<TypeElement>();
    filterClasses(classes, roundEnv.getRootElements());
    for (TypeElement element : classes) {
        webServiceProvider = element.getAnnotation(WebServiceProvider.class);
        webService = element.getAnnotation(WebService.class);
        if (webServiceProvider != null) {
            if (webService != null) {
                processError(WebserviceapMessages.WEBSERVICEAP_WEBSERVICE_AND_WEBSERVICEPROVIDER(element.getQualifiedName()));
            }
            processedEndpoint = true;
        }

        if (webService == null) {
            continue;
        }

        element.accept(webServiceVisitor, null);
        processedEndpoint = true;
    }
    if (!processedEndpoint) {
        if (isCommandLineInvocation) {
            if (!ignoreNoWebServiceFoundWarning) {
                processWarning(WebserviceapMessages.WEBSERVICEAP_NO_WEBSERVICE_ENDPOINT_FOUND());
            }
        } else {
            processError(WebserviceapMessages.WEBSERVICEAP_NO_WEBSERVICE_ENDPOINT_FOUND());
        }
    }
    return true;
}
 
Example 2
Source File: WebServiceAp.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
    if (context.getRound() != 1) {
        return true;
    }
    context.incrementRound();
    WebService webService;
    WebServiceProvider webServiceProvider;
    WebServiceVisitor webServiceVisitor = new WebServiceWrapperGenerator(this, context);
    boolean processedEndpoint = false;
    Collection<TypeElement> classes = new ArrayList<TypeElement>();
    filterClasses(classes, roundEnv.getRootElements());
    for (TypeElement element : classes) {
        webServiceProvider = element.getAnnotation(WebServiceProvider.class);
        webService = element.getAnnotation(WebService.class);
        if (webServiceProvider != null) {
            if (webService != null) {
                processError(WebserviceapMessages.WEBSERVICEAP_WEBSERVICE_AND_WEBSERVICEPROVIDER(element.getQualifiedName()));
            }
            processedEndpoint = true;
        }

        if (webService == null) {
            continue;
        }

        element.accept(webServiceVisitor, null);
        processedEndpoint = true;
    }
    if (!processedEndpoint) {
        if (isCommandLineInvocation) {
            if (!ignoreNoWebServiceFoundWarning) {
                processWarning(WebserviceapMessages.WEBSERVICEAP_NO_WEBSERVICE_ENDPOINT_FOUND());
            }
        } else {
            processError(WebserviceapMessages.WEBSERVICEAP_NO_WEBSERVICE_ENDPOINT_FOUND());
        }
    }
    return true;
}
 
Example 3
Source File: WebServiceAp.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
    if (context.getRound() != 1) {
        return true;
    }
    context.incrementRound();
    WebService webService;
    WebServiceProvider webServiceProvider;
    WebServiceVisitor webServiceVisitor = new WebServiceWrapperGenerator(this, context);
    boolean processedEndpoint = false;
    Collection<TypeElement> classes = new ArrayList<TypeElement>();
    filterClasses(classes, roundEnv.getRootElements());
    for (TypeElement element : classes) {
        webServiceProvider = element.getAnnotation(WebServiceProvider.class);
        webService = element.getAnnotation(WebService.class);
        if (webServiceProvider != null) {
            if (webService != null) {
                processError(WebserviceapMessages.WEBSERVICEAP_WEBSERVICE_AND_WEBSERVICEPROVIDER(element.getQualifiedName()));
            }
            processedEndpoint = true;
        }

        if (webService == null) {
            continue;
        }

        element.accept(webServiceVisitor, null);
        processedEndpoint = true;
    }
    if (!processedEndpoint) {
        if (isCommandLineInvocation) {
            if (!ignoreNoWebServiceFoundWarning) {
                processWarning(WebserviceapMessages.WEBSERVICEAP_NO_WEBSERVICE_ENDPOINT_FOUND());
            }
        } else {
            processError(WebserviceapMessages.WEBSERVICEAP_NO_WEBSERVICE_ENDPOINT_FOUND());
        }
    }
    return true;
}
 
Example 4
Source File: WebServiceAp.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
    if (context.getRound() != 1) {
        return true;
    }
    context.incrementRound();
    WebService webService;
    WebServiceProvider webServiceProvider;
    WebServiceVisitor webServiceVisitor = new WebServiceWrapperGenerator(this, context);
    boolean processedEndpoint = false;
    Collection<TypeElement> classes = new ArrayList<TypeElement>();
    filterClasses(classes, roundEnv.getRootElements());
    for (TypeElement element : classes) {
        webServiceProvider = element.getAnnotation(WebServiceProvider.class);
        webService = element.getAnnotation(WebService.class);
        if (webServiceProvider != null) {
            if (webService != null) {
                processError(WebserviceapMessages.WEBSERVICEAP_WEBSERVICE_AND_WEBSERVICEPROVIDER(element.getQualifiedName()));
            }
            processedEndpoint = true;
        }

        if (webService == null) {
            continue;
        }

        element.accept(webServiceVisitor, null);
        processedEndpoint = true;
    }
    if (!processedEndpoint) {
        if (isCommandLineInvocation) {
            if (!ignoreNoWebServiceFoundWarning) {
                processWarning(WebserviceapMessages.WEBSERVICEAP_NO_WEBSERVICE_ENDPOINT_FOUND());
            }
        } else {
            processError(WebserviceapMessages.WEBSERVICEAP_NO_WEBSERVICE_ENDPOINT_FOUND());
        }
    }
    return true;
}
 
Example 5
Source File: WebServiceAp.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
    if (context.getRound() != 1) {
        return true;
    }
    context.incrementRound();
    WebService webService;
    WebServiceProvider webServiceProvider;
    WebServiceVisitor webServiceVisitor = new WebServiceWrapperGenerator(this, context);
    boolean processedEndpoint = false;
    Collection<TypeElement> classes = new ArrayList<TypeElement>();
    filterClasses(classes, roundEnv.getRootElements());
    for (TypeElement element : classes) {
        webServiceProvider = element.getAnnotation(WebServiceProvider.class);
        webService = element.getAnnotation(WebService.class);
        if (webServiceProvider != null) {
            if (webService != null) {
                processError(WebserviceapMessages.WEBSERVICEAP_WEBSERVICE_AND_WEBSERVICEPROVIDER(element.getQualifiedName()));
            }
            processedEndpoint = true;
        }

        if (webService == null) {
            continue;
        }

        element.accept(webServiceVisitor, null);
        processedEndpoint = true;
    }
    if (!processedEndpoint) {
        if (isCommandLineInvocation) {
            if (!ignoreNoWebServiceFoundWarning) {
                processWarning(WebserviceapMessages.WEBSERVICEAP_NO_WEBSERVICE_ENDPOINT_FOUND());
            }
        } else {
            processError(WebserviceapMessages.WEBSERVICEAP_NO_WEBSERVICE_ENDPOINT_FOUND());
        }
    }
    return true;
}
 
Example 6
Source File: WebServicesHintsProvider.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void run(final CompilationInfo info) throws Exception{
    synchronized(singleInstanceLock){
        if (runningInstance != null){
            runningInstance.cancel();
        }
        runningInstance = this;
        // the 'cancelled' flag must be reset as the instance of WebServicesHintsProvider is reused
        cancelled = false;
        problemsFound.clear();
        for (Tree tree : info.getCompilationUnit().getTypeDecls()){
            if (isCancelled()){
                break;
            }
            
            if (TreeUtilities.CLASS_TREE_KINDS.contains(tree.getKind())){
                TreePath path = info.getTrees().getPath(info.getCompilationUnit(), tree);
                TypeElement javaClass = (TypeElement) info.getTrees().getElement(path);
                if (javaClass != null) {
                    initServiceMetadata(javaClass);
                    createProblemContext(info, javaClass);

                    RulesEngine rulesEngine = new WebServicesRulesEngine();
                    javaClass.accept(rulesEngine, context);
                    problemsFound.addAll(rulesEngine.getProblemsFound());

                    synchronized(cancellationLock){
                        context = null;
                    }
                }
            }
        }
        
        //TODO: should we really reset the errors if the task is cancelled?
        HintsController.setErrors(file, "WebService Verification", problemsFound); //NOI18N
        runningInstance = null;
    }
}
 
Example 7
Source File: WebServiceAp.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
    if (context.getRound() != 1) {
        return true;
    }
    context.incrementRound();
    WebService webService;
    WebServiceProvider webServiceProvider;
    WebServiceVisitor webServiceVisitor = new WebServiceWrapperGenerator(this, context);
    boolean processedEndpoint = false;
    Collection<TypeElement> classes = new ArrayList<TypeElement>();
    filterClasses(classes, roundEnv.getRootElements());
    for (TypeElement element : classes) {
        webServiceProvider = element.getAnnotation(WebServiceProvider.class);
        webService = element.getAnnotation(WebService.class);
        if (webServiceProvider != null) {
            if (webService != null) {
                processError(WebserviceapMessages.WEBSERVICEAP_WEBSERVICE_AND_WEBSERVICEPROVIDER(element.getQualifiedName()));
            }
            processedEndpoint = true;
        }

        if (webService == null) {
            continue;
        }

        element.accept(webServiceVisitor, null);
        processedEndpoint = true;
    }
    if (!processedEndpoint) {
        if (isCommandLineInvocation) {
            if (!ignoreNoWebServiceFoundWarning) {
                processWarning(WebserviceapMessages.WEBSERVICEAP_NO_WEBSERVICE_ENDPOINT_FOUND());
            }
        } else {
            processError(WebserviceapMessages.WEBSERVICEAP_NO_WEBSERVICE_ENDPOINT_FOUND());
        }
    }
    return true;
}
 
Example 8
Source File: Visitor.java    From helidon-build-tools with Apache License 2.0 5 votes vote down vote up
@Override
public CommandMetaModel visitType(TypeElement type, Void p) {
    if (implementsCommandExecution(type)) {
        Command annotation = type.getAnnotation(Command.class);
        CommandFragmentMetaModel fragment = type.accept(new CommandFragmentVisitor(), null);
        if (fragment != null) {
            return new CommandMetaModel(fragment.type(), fragment.pkg(), fragment.params(), annotation);
        }
    }
    return null;
}
 
Example 9
Source File: WebServiceAp.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
    if (context.getRound() != 1) {
        return true;
    }
    context.incrementRound();
    WebService webService;
    WebServiceProvider webServiceProvider;
    WebServiceVisitor webServiceVisitor = new WebServiceWrapperGenerator(this, context);
    boolean processedEndpoint = false;
    Collection<TypeElement> classes = new ArrayList<TypeElement>();
    filterClasses(classes, roundEnv.getRootElements());
    for (TypeElement element : classes) {
        webServiceProvider = element.getAnnotation(WebServiceProvider.class);
        webService = element.getAnnotation(WebService.class);
        if (webServiceProvider != null) {
            if (webService != null) {
                processError(WebserviceapMessages.WEBSERVICEAP_WEBSERVICE_AND_WEBSERVICEPROVIDER(element.getQualifiedName()));
            }
            processedEndpoint = true;
        }

        if (webService == null) {
            continue;
        }

        element.accept(webServiceVisitor, null);
        processedEndpoint = true;
    }
    if (!processedEndpoint) {
        if (isCommandLineInvocation) {
            if (!ignoreNoWebServiceFoundWarning) {
                processWarning(WebserviceapMessages.WEBSERVICEAP_NO_WEBSERVICE_ENDPOINT_FOUND());
            }
        } else {
            processError(WebserviceapMessages.WEBSERVICEAP_NO_WEBSERVICE_ENDPOINT_FOUND());
        }
    }
    return true;
}
 
Example 10
Source File: WebServiceAp.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
    if (context.getRound() != 1) {
        return true;
    }
    context.incrementRound();
    WebService webService;
    WebServiceProvider webServiceProvider;
    WebServiceVisitor webServiceVisitor = new WebServiceWrapperGenerator(this, context);
    boolean processedEndpoint = false;
    Collection<TypeElement> classes = new ArrayList<TypeElement>();
    filterClasses(classes, roundEnv.getRootElements());
    for (TypeElement element : classes) {
        webServiceProvider = element.getAnnotation(WebServiceProvider.class);
        webService = element.getAnnotation(WebService.class);
        if (webServiceProvider != null) {
            if (webService != null) {
                processError(WebserviceapMessages.WEBSERVICEAP_WEBSERVICE_AND_WEBSERVICEPROVIDER(element.getQualifiedName()));
            }
            processedEndpoint = true;
        }

        if (webService == null) {
            continue;
        }

        element.accept(webServiceVisitor, null);
        processedEndpoint = true;
    }
    if (!processedEndpoint) {
        if (isCommandLineInvocation) {
            if (!ignoreNoWebServiceFoundWarning) {
                processWarning(WebserviceapMessages.WEBSERVICEAP_NO_WEBSERVICE_ENDPOINT_FOUND());
            }
        } else {
            processError(WebserviceapMessages.WEBSERVICEAP_NO_WEBSERVICE_ENDPOINT_FOUND());
        }
    }
    return true;
}
 
Example 11
Source File: WebServiceVisitor.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
private void inspectEndpointInterface(String endpointInterfaceName, TypeElement d) {
    TypeElement intTypeElement = getEndpointInterfaceElement(endpointInterfaceName, d);
    if (intTypeElement != null)
        intTypeElement.accept(this, null);
}
 
Example 12
Source File: WebServiceVisitor.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
private void inspectEndpointInterface(String endpointInterfaceName, TypeElement d) {
    TypeElement intTypeElement = getEndpointInterfaceElement(endpointInterfaceName, d);
    if (intTypeElement != null)
        intTypeElement.accept(this, null);
}
 
Example 13
Source File: WebServiceVisitor.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
private void inspectEndpointInterface(String endpointInterfaceName, TypeElement d) {
    TypeElement intTypeElement = getEndpointInterfaceElement(endpointInterfaceName, d);
    if (intTypeElement != null)
        intTypeElement.accept(this, null);
}
 
Example 14
Source File: WebServiceVisitor.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
private void inspectEndpointInterface(String endpointInterfaceName, TypeElement d) {
    TypeElement intTypeElement = getEndpointInterfaceElement(endpointInterfaceName, d);
    if (intTypeElement != null)
        intTypeElement.accept(this, null);
}
 
Example 15
Source File: WebServiceVisitor.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
private void inspectEndpointInterface(String endpointInterfaceName, TypeElement d) {
    TypeElement intTypeElement = getEndpointInterfaceElement(endpointInterfaceName, d);
    if (intTypeElement != null)
        intTypeElement.accept(this, null);
}
 
Example 16
Source File: WebServiceVisitor.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
private void inspectEndpointInterface(String endpointInterfaceName, TypeElement d) {
    TypeElement intTypeElement = getEndpointInterfaceElement(endpointInterfaceName, d);
    if (intTypeElement != null)
        intTypeElement.accept(this, null);
}
 
Example 17
Source File: WebServiceVisitor.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
private void inspectEndpointInterface(String endpointInterfaceName, TypeElement d) {
    TypeElement intTypeElement = getEndpointInterfaceElement(endpointInterfaceName, d);
    if (intTypeElement != null)
        intTypeElement.accept(this, null);
}
 
Example 18
Source File: WebServiceVisitor.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
private void inspectEndpointInterface(String endpointInterfaceName, TypeElement d) {
    TypeElement intTypeElement = getEndpointInterfaceElement(endpointInterfaceName, d);
    if (intTypeElement != null)
        intTypeElement.accept(this, null);
}