Search in sources :

Example 1 with MemberCollector

use of com.google.gwt.inject.rebind.util.MemberCollector in project google-gin by gwtplus.

the class FactoryBindingTest method createInjectableCollector.

// Lifted from GuiceUtilTest
private MemberCollector createInjectableCollector() {
    MemberCollector collector = new MemberCollector(TreeLogger.NULL);
    collector.setMethodFilter(new MemberCollector.MethodFilter() {

        public boolean accept(MethodLiteral<?, Method> method) {
            return method.isAnnotationPresent(Inject.class) && !method.isStatic();
        }
    });
    collector.setFieldFilter(new MemberCollector.FieldFilter() {

        public boolean accept(FieldLiteral<?> field) {
            return field.isAnnotationPresent(Inject.class) && !field.isStatic();
        }
    });
    return collector;
}
Also used : Method(java.lang.reflect.Method) MemberCollector(com.google.gwt.inject.rebind.util.MemberCollector)

Example 2 with MemberCollector

use of com.google.gwt.inject.rebind.util.MemberCollector in project gwt-test-utils by gwt-test-utils.

the class GInjectorCreateHandler method readGuiceModules.

private Set<Module> readGuiceModules(Class<? extends GinModule>[] classLiterals, Class<? extends Ginjector> ginectorClass) throws Exception {
    Set<Module> modules = new HashSet<>();
    for (Class<? extends GinModule> literal : classLiterals) {
        LOGGER.debug("wrapping GinModule literal " + literal);
        MemberCollector memberCollector = new MemberCollector(GwtTreeLogger.get());
        GuiceUtil guiceUtil = new GuiceUtil(memberCollector);
        modules.add(new GinModuleAdapter(literal.newInstance(), new GinjectorBindings(null, GwtTreeLogger.get(), guiceUtil, ginectorClass, null, memberCollector, null, null)));
    }
    return modules;
}
Also used : GinjectorBindings(com.google.gwt.inject.rebind.GinjectorBindings) GuiceUtil(com.google.gwt.inject.rebind.util.GuiceUtil) GinModuleAdapter(com.google.gwt.inject.rebind.adapter.GinModuleAdapter) Module(com.google.inject.Module) GinModule(com.google.gwt.inject.client.GinModule) MemberCollector(com.google.gwt.inject.rebind.util.MemberCollector) HashSet(java.util.HashSet)

Aggregations

MemberCollector (com.google.gwt.inject.rebind.util.MemberCollector)2 GinModule (com.google.gwt.inject.client.GinModule)1 GinjectorBindings (com.google.gwt.inject.rebind.GinjectorBindings)1 GinModuleAdapter (com.google.gwt.inject.rebind.adapter.GinModuleAdapter)1 GuiceUtil (com.google.gwt.inject.rebind.util.GuiceUtil)1 Module (com.google.inject.Module)1 Method (java.lang.reflect.Method)1 HashSet (java.util.HashSet)1