本文整理汇总了Java中org.codehaus.groovy.ast.ModuleNode.getClasses方法的典型用法代码示例。如果您正苦于以下问题:Java ModuleNode.getClasses方法的具体用法?Java ModuleNode.getClasses怎么用?Java ModuleNode.getClasses使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.codehaus.groovy.ast.ModuleNode
的用法示例。
在下文中一共展示了ModuleNode.getClasses方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visit
import org.codehaus.groovy.ast.ModuleNode; //导入方法依赖的package包/类
public void visit(ASTNode[] nodes, SourceUnit source) {
if (nodes.length == 0 || !(nodes[0] instanceof ModuleNode)) {
source.getErrorCollector().addError(new SimpleMessage(
"internal error in DetectorTransform", source));
return;
}
ModuleNode module = (ModuleNode)nodes[0];
for (ClassNode clazz : (List<ClassNode>)module.getClasses()) {
FieldNode field = clazz.getField(VERSION_FIELD_NAME);
if (field != null) {
field.setInitialValueExpression(new ConstantExpression(ReleaseInfo.getVersion()));
break;
}
}
}
示例2: visitModule
import org.codehaus.groovy.ast.ModuleNode; //导入方法依赖的package包/类
private void visitModule(ModuleNode module) {
for (ClassNode classNode : module.getClasses()) {
AnnotationNode annotation = new AnnotationNode(new ClassNode(Grab.class));
annotation.addMember("value", new ConstantExpression("groovy"));
classNode.addAnnotation(annotation);
// We only need to do it at most once
break;
}
// Disable the addition of a static initializer that calls Grape.addResolver
// because all the dependencies are local now
disableGrabResolvers(module.getClasses());
disableGrabResolvers(module.getImports());
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:14,代码来源:ArchiveCommand.java
示例3: visitModule
import org.codehaus.groovy.ast.ModuleNode; //导入方法依赖的package包/类
private void visitModule(ModuleNode module) {
DependencyCustomizer dependencies = new DependencyCustomizer(this.loader, module,
this.dependencyResolutionContext);
for (ClassNode classNode : module.getClasses()) {
for (CompilerAutoConfiguration autoConfiguration : this.compilerAutoConfigurations) {
if (autoConfiguration.matches(classNode)) {
autoConfiguration.applyDependencies(dependencies);
}
}
}
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:12,代码来源:DependencyAutoConfigurationTransformation.java
示例4: visit
import org.codehaus.groovy.ast.ModuleNode; //导入方法依赖的package包/类
@Override
public void visit(ASTNode[] nodes, SourceUnit source) {
for (ASTNode node : nodes) {
if (node instanceof ModuleNode) {
ModuleNode module = (ModuleNode) node;
for (ClassNode classNode : new ArrayList<ClassNode>(
module.getClasses())) {
if (classNode.isScript()) {
classNode.visitContents(new ClassVisitor(source, classNode));
}
}
}
}
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:15,代码来源:GroovyBeansTransformation.java
示例5: getPrimaryClassNodes
import org.codehaus.groovy.ast.ModuleNode; //导入方法依赖的package包/类
private List<ClassNode> getPrimaryClassNodes(boolean sort) {
List<ClassNode> unsorted = new ArrayList<ClassNode>();
for (ModuleNode module : this.ast.getModules()) {
for (ClassNode classNode : module.getClasses()) {
unsorted.add(classNode);
}
}
if (!sort) return unsorted;
int unsortedSize = unsorted.size();
int[] indexClass = new int[unsortedSize];
int[] indexInterface = new int[unsortedSize];
{
int i = 0;
for (Iterator<ClassNode> iter = unsorted.iterator(); iter.hasNext(); i++) {
ClassNode element = iter.next();
if (element.isInterface()) {
indexInterface[i] = getSuperInterfaceCount(element);
indexClass[i] = -1;
} else {
indexClass[i] = getSuperClassCount(element);
indexInterface[i] = -1;
}
}
}
List<ClassNode> sorted = getSorted(indexInterface, unsorted);
sorted.addAll(getSorted(indexClass, unsorted));
return sorted;
}
示例6: getCompiledFiles
import org.codehaus.groovy.ast.ModuleNode; //导入方法依赖的package包/类
private List<OutputItem> getCompiledFiles(CompilationUnit compilationUnit) throws IOException {
File targetDirectory = compilationUnit.getConfiguration().getTargetDirectory();
if (forStubs) {
return getStubOutputItems(compilationUnit, targetDirectory);
}
final SortedSet<String> allClasses = new TreeSet<String>();
//noinspection unchecked
List<GroovyClass> listOfClasses = compilationUnit.getClasses();
for (GroovyClass listOfClass : listOfClasses) {
allClasses.add(listOfClass.getName());
}
List<OutputItem> compiledFiles = new ArrayList<OutputItem>();
for (Iterator iterator = compilationUnit.iterator(); iterator.hasNext();) {
SourceUnit sourceUnit = (SourceUnit) iterator.next();
String fileName = sourceUnit.getName();
//for debug purposes
//System.out.println("source: " + fileName);
//System.out.print("classes:");
final ModuleNode ast = sourceUnit.getAST();
final List<ClassNode> topLevelClasses = ast.getClasses();
for (ClassNode classNode : topLevelClasses) {
final String topLevel = classNode.getName();
final String nested = topLevel + "$";
final SortedSet<String> tail = allClasses.tailSet(topLevel);
for (Iterator<String> tailItr = tail.iterator(); tailItr.hasNext(); ) {
String className = tailItr.next();
if (className.equals(topLevel) || className.startsWith(nested)) {
tailItr.remove();
compiledFiles.add(new OutputItem(targetDirectory, className.replace('.', '/') + ".class", fileName));
}
else {
break;
}
}
}
}
return compiledFiles;
}