org.jnosql.artemis.arangodb.document.ArangoDBRepositoryBean Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of aragangodb-extension Show documentation
Show all versions of aragangodb-extension Show documentation
Eclipse JNoSQL mapping layer, Artemis, to ArangoDB
/*
* 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.arangodb.document;
import org.jnosql.artemis.Repository;
import org.jnosql.artemis.document.DocumentRepositoryProducer;
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.inject.Default;
import javax.enterprise.inject.spi.Bean;
import javax.enterprise.inject.spi.BeanManager;
import javax.enterprise.inject.spi.InjectionPoint;
import javax.enterprise.inject.spi.PassivationCapable;
import javax.enterprise.util.AnnotationLiteral;
import java.lang.annotation.Annotation;
import java.lang.reflect.Proxy;
import java.lang.reflect.Type;
import java.util.Collections;
import java.util.Set;
class ArangoDBRepositoryBean implements Bean, PassivationCapable {
private final Class type;
private final BeanManager beanManager;
private final Set types;
private final Set qualifiers = Collections.singleton(new AnnotationLiteral() {
});
ArangoDBRepositoryBean(Class type, BeanManager beanManager) {
this.type = type;
this.beanManager = beanManager;
this.types = Collections.singleton(type);
}
@Override
public Class> getBeanClass() {
return type;
}
@Override
public Set getInjectionPoints() {
return Collections.emptySet();
}
@Override
public boolean isNullable() {
return false;
}
@Override
public ArangoDBRepository create(CreationalContext creationalContext) {
ArangoDBTemplate template = getInstance(ArangoDBTemplate.class);
DocumentRepositoryProducer producer = getInstance(DocumentRepositoryProducer.class);
Repository