use of jakarta.nosql.mapping.Converters in project jnosql-diana by eclipse.
the class SelectQueryConverterTest method shouldRunQuery8.
@ParameterizedTest(name = "Should parser the query {0}")
@ValueSource(strings = { "findByAgeLessThanOrderByName" })
public void shouldRunQuery8(String methodName) {
Method method = Stream.of(PersonRepository.class.getMethods()).filter(m -> m.getName().equals(methodName)).findFirst().get();
graph.addVertex(T.label, "Person", "name", "Otavio", "age", 30);
graph.addVertex(T.label, "Person", "name", "Ada", "age", 40);
graph.addVertex(T.label, "Person", "name", "Poliana", "age", 25);
ClassMapping mapping = mappings.get(Person.class);
GraphQueryMethod queryMethod = new GraphQueryMethod(mapping, graph.traversal().V(), converters, method, new Object[] { 100 });
List<Vertex> vertices = converter.apply(queryMethod, null).collect(Collectors.toList());
List<Object> names = vertices.stream().map(v -> v.value("name")).collect(Collectors.toList());
assertEquals(3, vertices.size());
MatcherAssert.assertThat(names, Matchers.contains("Ada", "Otavio", "Poliana"));
}
use of jakarta.nosql.mapping.Converters in project jnosql-diana by eclipse.
the class RepositoryColumnBean method create.
@Override
public Repository create(CreationalContext<Repository> creationalContext) {
ClassMappings classMappings = getInstance(ClassMappings.class);
ColumnTemplate template = provider.isEmpty() ? getInstance(ColumnTemplate.class) : getInstance(ColumnTemplate.class, DatabaseQualifier.ofColumn(provider));
Converters converters = getInstance(Converters.class);
ColumnRepositoryProxy handler = new ColumnRepositoryProxy(template, classMappings, type, converters);
return (Repository) Proxy.newProxyInstance(type.getClassLoader(), new Class[] { type }, handler);
}
use of jakarta.nosql.mapping.Converters 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);
}
Aggregations