本文整理汇总了Java中spoon.reflect.factory.Factory.getEnvironment方法的典型用法代码示例。如果您正苦于以下问题:Java Factory.getEnvironment方法的具体用法?Java Factory.getEnvironment怎么用?Java Factory.getEnvironment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类spoon.reflect.factory.Factory
的用法示例。
在下文中一共展示了Factory.getEnvironment方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: printJavaFileWithComment
import spoon.reflect.factory.Factory; //导入方法依赖的package包/类
public static void printJavaFileWithComment(CtType<?> type, File directory) {
Factory factory = type.getFactory();
Environment env = factory.getEnvironment();
env.setAutoImports(true);
env.setCommentEnabled(true);
JavaOutputProcessor processor = new JavaOutputProcessor(directory, new DefaultJavaPrettyPrinter(env));
processor.setFactory(factory);
processor.createJavaFile(type);
env.setAutoImports(false);
}
示例2: printAllClasses
import spoon.reflect.factory.Factory; //导入方法依赖的package包/类
public static void printAllClasses(Factory factory, File out, File fileFrom) {
Environment env = factory.getEnvironment();
Processor processor = new JavaOutputProcessorWithFilter(out, new DefaultJavaPrettyPrinter(env), allClassesName(fileFrom));
try {
ProcessingManager pm = new QueueProcessingManager(factory);
pm.addProcessor(processor);
pm.process(factory.Package().getRootPackage());
} catch (Exception e) {
e.printStackTrace();
}
}
示例3: printJavaFile
import spoon.reflect.factory.Factory; //导入方法依赖的package包/类
public static void printJavaFile(File directory, CtType type) throws IOException {
try {
Factory factory = type.getFactory();
Environment env = factory.getEnvironment();
JavaOutputProcessor processor = new JavaOutputProcessor(directory, new DefaultJavaPrettyPrinter(env));
processor.setFactory(factory);
processor.createJavaFile(type);
Log.trace("write type {} in directory {}", type.getQualifiedName(), directory);
} catch (Exception e) {
e.printStackTrace();
}
}
示例4: printJavaFile
import spoon.reflect.factory.Factory; //导入方法依赖的package包/类
@Override
public void printJavaFile(String directory) throws IOException {
CtType<?> type = getPosition().getCompilationUnit().getMainType();
Factory factory = type.getFactory();
Environment env = factory.getEnvironment();
JavaOutputProcessor processor = new JavaOutputProcessor(new File(directory), new DefaultJavaPrettyPrinter(env));
processor.setFactory(factory);
processor.createJavaFile(type);
Log.debug("write type {} in directory {}", type.getQualifiedName(), directory);
}
示例5: printJavaFile
import spoon.reflect.factory.Factory; //导入方法依赖的package包/类
@Override
public void printJavaFile(String srcDir) throws IOException {
CtType<?> type = loop.getParent(CtType.class);
Factory factory = type.getFactory();
Environment env = factory.getEnvironment();
JavaOutputProcessor processor = new JavaOutputProcessor(new File(srcDir), new DefaultJavaPrettyPrinter(env));
processor.setFactory(factory);
processor.createJavaFile(type);
Log.debug("write type {} in directory {}", type.getQualifiedName(), srcDir);
}
示例6: printJavaFile
import spoon.reflect.factory.Factory; //导入方法依赖的package包/类
@Override
public void printJavaFile(String directory) throws IOException {
CtType<?> type = transformation.getOriginalClass(transformation.getTransplantationPoint());
Factory factory = type.getFactory();
Environment env = factory.getEnvironment();
JavaOutputProcessor processor = new JavaOutputProcessor(new File(directory), new DefaultJavaPrettyPrinter(env));
processor.setFactory(factory);
processor.createJavaFile(type);
Log.debug("write type {} in directory {}", type.getQualifiedName(), directory);
}
示例7: printJavaFile
import spoon.reflect.factory.Factory; //导入方法依赖的package包/类
/**
* Prints the modified java file. When the transformation is done a new java file is created. This method performs a
* pretty print of it
*
* @param directory Directory where the java file is going to be placed
* @throws IOException
*/
public void printJavaFile(String directory) throws IOException {
CtType<?> type = getOriginalClass(transplantationPoint);
Factory factory = type.getFactory();
Environment env = factory.getEnvironment();
JavaOutputProcessor processor = new JavaOutputProcessor(new File(directory), new DefaultJavaPrettyPrinter(env));
processor.setFactory(factory);
processor.createJavaFile(type);
Log.debug("write type {} in directory {}", type.getQualifiedName(), directory);
}
示例8: printJavaFile
import spoon.reflect.factory.Factory; //导入方法依赖的package包/类
public void printJavaFile(String directory) throws IOException {
CtType<?> type = getPosition().getCompilationUnit().getMainType();
Factory factory = type.getFactory();
Environment env = factory.getEnvironment();
JavaOutputProcessor processor = new JavaOutputProcessor(new File(directory), new DefaultJavaPrettyPrinter(env));
processor.setFactory(factory);
processor.createJavaFile(type);
Log.debug("write type {} in directory {}", type.getQualifiedName(), directory);
}