Search in sources :

Example 1 with ReactiveDocumentTemplateProducer

use of org.eclipse.jnosql.mapping.document.reactive.ReactiveDocumentTemplateProducer in project jnosql-diana by eclipse.

the class ReactiveDocumentManagerConverter method success.

@Override
protected ReactiveDocumentTemplate success(String value) {
    Config config = BeanManagers.getInstance(Config.class);
    final DocumentTemplate template = config.getValue(value, DocumentTemplate.class);
    ReactiveDocumentTemplateProducer producer = BeanManagers.getInstance(ReactiveDocumentTemplateProducer.class);
    return producer.get(template);
}
Also used : Config(org.eclipse.microprofile.config.Config) ReactiveDocumentTemplate(org.eclipse.jnosql.mapping.document.reactive.ReactiveDocumentTemplate) DocumentTemplate(jakarta.nosql.mapping.document.DocumentTemplate) ReactiveDocumentTemplateProducer(org.eclipse.jnosql.mapping.document.reactive.ReactiveDocumentTemplateProducer)

Example 2 with ReactiveDocumentTemplateProducer

use of org.eclipse.jnosql.mapping.document.reactive.ReactiveDocumentTemplateProducer in project jnosql-diana by eclipse.

the class ReactiveRepositoryDocumentBean method create.

@Override
public ReactiveRepository<?, ?> create(CreationalContext<ReactiveRepository<?, ?>> context) {
    ClassMappings classMappings = getInstance(ClassMappings.class);
    DocumentTemplate template = provider.isEmpty() ? getInstance(DocumentTemplate.class) : getInstance(DocumentTemplate.class, DatabaseQualifier.ofDocument(provider));
    ReactiveDocumentTemplateProducer reactiveProducer = getInstance(ReactiveDocumentTemplateProducer.class);
    final ReactiveDocumentTemplate reactiveDocumentTemplate = reactiveProducer.get(template);
    Converters converters = getInstance(Converters.class);
    ReactiveDocumentRepositoryProxy<?> handler = new ReactiveDocumentRepositoryProxy<>(reactiveDocumentTemplate, template, converters, classMappings, type);
    return (ReactiveRepository<?, ?>) Proxy.newProxyInstance(type.getClassLoader(), new Class[] { type }, handler);
}
Also used : ReactiveRepository(org.eclipse.jnosql.mapping.reactive.ReactiveRepository) ReactiveDocumentTemplate(org.eclipse.jnosql.mapping.document.reactive.ReactiveDocumentTemplate) Converters(jakarta.nosql.mapping.Converters) ReactiveDocumentTemplate(org.eclipse.jnosql.mapping.document.reactive.ReactiveDocumentTemplate) DocumentTemplate(jakarta.nosql.mapping.document.DocumentTemplate) ReactiveDocumentTemplateProducer(org.eclipse.jnosql.mapping.document.reactive.ReactiveDocumentTemplateProducer) ClassMappings(org.eclipse.jnosql.mapping.reflection.ClassMappings)

Aggregations

DocumentTemplate (jakarta.nosql.mapping.document.DocumentTemplate)2 ReactiveDocumentTemplate (org.eclipse.jnosql.mapping.document.reactive.ReactiveDocumentTemplate)2 ReactiveDocumentTemplateProducer (org.eclipse.jnosql.mapping.document.reactive.ReactiveDocumentTemplateProducer)2 Converters (jakarta.nosql.mapping.Converters)1 ReactiveRepository (org.eclipse.jnosql.mapping.reactive.ReactiveRepository)1 ClassMappings (org.eclipse.jnosql.mapping.reflection.ClassMappings)1 Config (org.eclipse.microprofile.config.Config)1