本文整理匯總了Java中com.google.gwt.inject.client.AbstractGinModule類的典型用法代碼示例。如果您正苦於以下問題:Java AbstractGinModule類的具體用法?Java AbstractGinModule怎麽用?Java AbstractGinModule使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
AbstractGinModule類屬於com.google.gwt.inject.client包,在下文中一共展示了AbstractGinModule類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createModule
import com.google.gwt.inject.client.AbstractGinModule; //導入依賴的package包/類
private String createModule(TreeLogger logger, GeneratorContext context, JClassType requestedType,
String packageName, String requestedName) {
String moduleName = requestedName + "Module";
ClassSourceFileComposerFactory moduleFactory =
new ClassSourceFileComposerFactory(packageName, moduleName);
moduleFactory.setSuperclass(AbstractGinModule.class.getCanonicalName());
moduleFactory.addImport(Names.class.getCanonicalName());
SourceWriter moduleWriter = moduleFactory.createSourceWriter(context,
context.tryCreate(logger, packageName, moduleName));
moduleWriter.println("public void configure() {");
moduleWriter.indent();
for (JMethod method : requestedType.getMethods()) {
if (method.getName().startsWith("set")) {
String name = method.getParameters()[0].getAnnotation(Named.class).value();
moduleWriter.println("bindConstant().annotatedWith(Names.named(\"" + name + "\")).to(\""
+ Math.pow(Integer.parseInt(name), 2) + "\");");
}
}
moduleWriter.outdent();
moduleWriter.println("}");
moduleWriter.commit(logger);
return moduleName;
}
示例2: configure
import com.google.gwt.inject.client.AbstractGinModule; //導入依賴的package包/類
public void configure(Binder binder) {
// For Guice error reporting, ignore the adapters
binder = binder.skipSources(GinModuleAdapter.class, BinderAdapter.class,
AbstractGinModule.class);
ginModule.configure(new BinderAdapter(binder, bindings));
// Install provider methods from the GinModule
binder.install(ProviderMethodsModule.forObject(ginModule));
}