List of usage examples for com.google.gwt.dev.cfg ModuleDefLoader loadFromClassPath
public static ModuleDef loadFromClassPath(TreeLogger logger, String moduleName) throws UnableToCompleteException
From source file:com.google.code.gwt.appcache.rebind.ApplicationCacheNetworkSectionGenerator.java
License:Apache License
/** * Invokes the deferred binding rule(s) in the specified module to the * specified typeName.//from www.ja v a 2s.c om * * @param module the module (which is already inherited!) to use as 'parent' * module * @param logger * @param context * @param typeName the name of the type to rebind * @throws UnableToCompleteException if the module can't provide a substitute * @return the rebound typeName, or <code>null</code> if no binding took place */ private String rebindTypeByInheritedModule(String module, TreeLogger logger, GeneratorContext context, String typeName) throws UnableToCompleteException { ModuleDef rpcModule = ModuleDefLoader.loadFromClassPath(logger, module); Iterator<Rule> iter = rpcModule.getRules().iterator(); while (iter.hasNext()) { Rule r = iter.next(); if (r.isApplicable(logger, context, typeName)) { logger.log(TreeLogger.DEBUG, "The inherited module " + module + " found a rebinder for type " + typeName + " by rule " + r); return r.realize(logger, context, typeName); } } logger.log(TreeLogger.WARN, "The inherit module rebinder did not rebind anything for type " + typeName + " in inherited module " + module); return null; }
From source file:org.hibernate.jsr303.tck.util.TckGeneratorTestUtils.java
License:Apache License
private static StandardGeneratorContext createGeneratorContext(String fullyQaulifiedModuleName, TreeLogger logger) throws UnableToCompleteException { ModuleDef module = ModuleDefLoader.loadFromClassPath(logger, fullyQaulifiedModuleName); File genDir = new File(System.getProperty("java.io.tmpdir")); ArtifactSet allGenreatedArtifacts = new ArtifactSet(); boolean isProd = false; StandardGeneratorContext context = new StandardGeneratorContext(module.getCompilationState(logger), module, genDir, allGenreatedArtifacts, isProd); return context; }