io.micronaut.core.io.service.ServiceDefinition Java Examples

The following examples show how to use io.micronaut.core.io.service.ServiceDefinition. 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: AbstractMicronautExtension.java    From micronaut-test with Apache License 2.0 6 votes vote down vote up
private Map<String, PropertySourceLoader> readPropertySourceLoaderMap() {
    Map<String, PropertySourceLoader> loaderMap = AbstractMicronautExtension.loaderMap;
    if (loaderMap == null) {
        loaderMap = new HashMap<>();
        AbstractMicronautExtension.loaderMap = loaderMap;
        SoftServiceLoader<PropertySourceLoader> loaders = SoftServiceLoader.load(PropertySourceLoader.class);
        for (ServiceDefinition<PropertySourceLoader> loader : loaders) {
            if (loader.isPresent()) {
                PropertySourceLoader psl = loader.load();
                Set<String> extensions = psl.getExtensions();
                for (String extension : extensions) {
                    loaderMap.put(extension, psl);
                }
            }
        }
    }
    return loaderMap;
}
 
Example #2
Source File: RepositoryTypeElementVisitor.java    From micronaut-data with Apache License 2.0 5 votes vote down vote up
private List<MethodCandidate> initializeMethodCandidates(VisitorContext context) {
    List<MethodCandidate> finderList = Arrays.asList(
            new FindByFinder(),
            new ExistsByFinder(),
            new SaveEntityMethod(),
            new SaveOneMethod(),
            new SaveAllMethod(),
            new ListMethod(),
            new CountMethod(),
            new DeleteByMethod(),
            new DeleteMethod(),
            new CountByMethod(),
            new UpdateMethod(),
            new UpdateEntityMethod(),
            new UpdateByMethod(),
            new ListSliceMethod(),
            new FindSliceByMethod(),
            new ListSliceMethod(),
            new FindPageByMethod(),
            new ListPageMethod(),
            new FindOneMethod(),
            new FindByIdsMethod(),
            new FindOneSpecificationMethod(),
            new CountSpecificationMethod(),
            new FindAllSpecificationMethod(),
            new FindPageSpecificationMethod()
    );
    SoftServiceLoader<MethodCandidate> otherCandidates = SoftServiceLoader.load(MethodCandidate.class);
    for (ServiceDefinition<MethodCandidate> definition : otherCandidates) {
        if (definition.isPresent()) {
            try {
                finderList.add(definition.load());
            } catch (Exception e) {
                context.warn("Could not load Data method candidate [" + definition.getName() + "]: " + e.getMessage(), null);
            }
        }
    }
    OrderUtil.sort(finderList);
    return finderList;
}