public Class<? extends Bootstrapper> generate() {
final String packageName = Bootstrapper.class.getPackage().getName();
final String className = "MockBootstrapperImpl";
final IOCBootstrapGenerator bootstrapGenerator = new IOCBootstrapGenerator(GeneratorContextBuilder.newCoreBasedBuilder().buildGeneratorContext(),
new TreeLogger() {
@Override
public TreeLogger branch(final Type type, final String msg, final Throwable caught, final HelpInfo helpInfo) {
return null;
}
@Override
public boolean isLoggable(final Type type) {
return false;
}
@Override
public void log(final Type type, final String msg, final Throwable caught, final HelpInfo helpInfo) {
System.out.println(type.getLabel() + ": " + msg);
if (caught != null) {
caught.printStackTrace();
}
}
}, packages, true);
final String classStr = bootstrapGenerator.generate(packageName, className);
final File fileCacheDir = RebindUtils.getErraiCacheDir();
final File cacheFile = new File(fileCacheDir.getAbsolutePath() + "/" + className + ".java");
RebindUtils.writeStringToFile(cacheFile, classStr);