com.jaregu.database.queries.ext.guice.QueriesModule Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of queries Show documentation
Show all versions of queries Show documentation
Java based SQL templating project. Store your queries in *.sql files and build queries for execution. Supports simple expressions and conditional clauses and interface proxying for java-sql bridge.
package com.jaregu.database.queries.ext.guice;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.inject.Provider;
import javax.inject.Singleton;
import com.google.inject.AbstractModule;
import com.google.inject.Key;
import com.google.inject.Module;
import com.google.inject.TypeLiteral;
import com.google.inject.multibindings.MapBinder;
import com.google.inject.multibindings.Multibinder;
import com.jaregu.database.queries.Queries;
import com.jaregu.database.queries.compiling.Entities;
import com.jaregu.database.queries.parsing.QueriesSource;
import com.jaregu.database.queries.parsing.QueriesSources;
import com.jaregu.database.queries.parsing.Sources;
public class QueriesModule {
private QueriesModule() {
}
public static Module queriesModule() {
return new AbstractModule() {
@Override
protected void configure() {
// MME called at least one time for guice to create empty list if no source is supplied
Multibinder.newSetBinder(binder(), QueriesSource.class);
// MME called at least one time for guice to create empty list if no configurator is supplied
Multibinder.newSetBinder(binder(), QueriesConfigurator.class);
// MME called at least one time for guice to create empty list if no entity class is registered
MapBinder.newMapBinder(binder(),
new TypeLiteral() {
}, new TypeLiteral>() {
});
TypeLiteral> sourcesType = new TypeLiteral>() {
};
TypeLiteral