
org.jnosql.artemis.column.query.ColumnRepositoryAsyncProxy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of artemis-column Show documentation
Show all versions of artemis-column Show documentation
Eclipse JNoSQL Mapping, Artemis API, to column NoSQL databases
/*
* Copyright (c) 2017 Otávio Santana and others
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Apache License v2.0 which accompanies this distribution.
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
* and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php.
*
* You may elect to redistribute this code under either of these licenses.
*
* Contributors:
*
* Otavio Santana
*/
package org.jnosql.artemis.column.query;
import org.jnosql.artemis.Converters;
import org.jnosql.artemis.RepositoryAsync;
import org.jnosql.artemis.column.ColumnTemplateAsync;
import org.jnosql.artemis.reflection.ClassRepresentation;
import org.jnosql.artemis.reflection.ClassRepresentations;
import org.jnosql.artemis.reflection.Reflections;
import java.lang.reflect.ParameterizedType;
/**
* Proxy handle to generate {@link RepositoryAsync}
*
* @param the type
*/
class ColumnRepositoryAsyncProxy extends AbstractColumnRepositoryAsyncProxy {
private final ColumnTemplateAsync template;
private final ColumnRepositoryAsync repository;
private final ClassRepresentation classRepresentation;
private final ColumnQueryParser queryParser;
private final ColumnQueryDeleteParser deleteParser;
private final Converters converters;
ColumnRepositoryAsyncProxy(ColumnTemplateAsync template, ClassRepresentations classRepresentations,
Class> repositoryType, Reflections reflections, Converters converters) {
this.template = template;
Class typeClass = Class.class.cast(ParameterizedType.class.cast(repositoryType.getGenericInterfaces()[0])
.getActualTypeArguments()[0]);
this.classRepresentation = classRepresentations.get(typeClass);
this.repository = new ColumnRepositoryAsync(template, reflections, classRepresentation);
this.converters = converters;
this.queryParser = new ColumnQueryParser();
this.deleteParser = new ColumnQueryDeleteParser();
}
@Override
protected RepositoryAsync getRepository() {
return repository;
}
@Override
protected ClassRepresentation getClassRepresentation() {
return classRepresentation;
}
@Override
protected ColumnQueryParser getQueryParser() {
return queryParser;
}
@Override
protected ColumnQueryDeleteParser getDeleteParser() {
return deleteParser;
}
@Override
protected ColumnTemplateAsync getTemplate() {
return template;
}
@Override
protected Converters getConverters() {
return converters;
}
class ColumnRepositoryAsync extends AbstractColumnRepositoryAsync implements RepositoryAsync {
private final ColumnTemplateAsync template;
private final Reflections reflections;
private final ClassRepresentation classRepresentation;
ColumnRepositoryAsync(ColumnTemplateAsync repository, Reflections reflections, ClassRepresentation classRepresentation) {
this.template = repository;
this.reflections = reflections;
this.classRepresentation = classRepresentation;
}
@Override
protected ColumnTemplateAsync getTemplate() {
return template;
}
@Override
protected Reflections getReflections() {
return reflections;
}
@Override
protected ClassRepresentation getClassRepresentation() {
return classRepresentation;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy