protected void addImport(ClassNode type, String name, String aliasName, List<AnnotationNode> annotations) { if (aliasName == null) aliasName=name; output.addImport(aliasName, type, annotations); }
public void addImport(String alias, ClassNode type) { addImport(alias, type, new ArrayList<AnnotationNode>()); }
@Override public void call(final SourceUnit source, final GeneratorContext context, final ClassNode classNode) throws CompilationFailedException { final ModuleNode ast = source.getAST(); for (Import anImport : imports) { switch (anImport.type) { case regular: ast.addImport(anImport.alias, anImport.classNode); break; case staticImport: ast.addStaticImport(anImport.classNode, anImport.field, anImport.alias); break; case staticStar: ast.addStaticStarImport(anImport.alias, anImport.classNode); break; case star: ast.addStarImport(anImport.star); break; } } }
public void visit(ASTNode[] nodes, final SourceUnit source) { log.log(Level.FINE, "Transforming source to add default import package"); for (Class<?> defaultImport : defaultImports) { log.log(Level.FINE, "Adding default import for class " + defaultImport.getName()); if (source.getAST().getImport(defaultImport.getSimpleName()) == null) { source.getAST().addImport(defaultImport.getSimpleName(), ClassHelper.make(defaultImport)); } } for (Class<?> defaultStaticImport : defaultStaticImports) { log.log(Level.FINE, "Adding default static import for class " + defaultStaticImport.getName()); if (!source.getAST().getStaticStarImports().containsKey(defaultStaticImport.getSimpleName())) { source.getAST().addStaticStarImport(defaultStaticImport.getSimpleName(), ClassHelper.make(defaultStaticImport)); } } } }
protected void addImport(ClassNode type, String name, String aliasName, List<AnnotationNode> annotations) { if (aliasName == null) aliasName=name; output.addImport(aliasName, type, annotations); }
protected void importClass(ClassNode type, String name, String as) { if (as == null) as=name; output.addImport(as, type); imports.put(as, type); }
protected void importClass(ClassNode type, String name, String as) { if (as == null) as=name; output.addImport(as, type); imports.put(as, type); }
protected void importClass(ClassNode type, String name, String as) { if (as == null) as=name; output.addImport(as, type); imports.put(as, type); }
public void addImport(String alias, ClassNode type) { addImport(alias, type, new ArrayList<AnnotationNode>()); }
/** * Adds an import to the {@link ModuleNode} containing the {@link * ClassNode} passed as first argument. * * @param classNode the {@link ClassNode} where the import will be added * @param clazz the type {@link Class} of the import * @since 0.3.0 */ public void addImport(final ClassNode classNode, final Class clazz) { classNode.getModule().addImport(clazz.getSimpleName(), ClassHelper.make(clazz, false)); }
/** * Adds an import to the {@link ModuleNode} containing the {@link * ClassNode} passed as first argument. * * @param classNode the {@link ClassNode} where the import will be added * @param clazz the type {@link Class} of the import * @param alias an alias to avoid class collisions * @since 0.3.0 */ public void addImport(final ClassNode classNode, final Class clazz, final String alias) { classNode.getModule().addImport(alias, ClassHelper.make(clazz, false)); }
/** * Adds an import to the {@link ModuleNode} containing the {@link * ClassNode} passed as first argument. * * @param classNode the {@link ClassNode} where the import will be added * @param clazz the string representing the qualified class of the import * @param alias an alias to avoid class collisions * @since 0.3.0 */ public void addImport(final ClassNode classNode, final String clazz, final String alias) { classNode.getModule().addImport(alias, ClassHelper.make(clazz)); }
public void visit(ASTNode[] nodes, final SourceUnit source) { log.log(Level.FINE, "Transforming source to add default import package"); for (Class<?> defaultImport : defaultImports) { log.log(Level.FINE, "Adding default import for class " + defaultImport.getName()); if (source.getAST().getImport(defaultImport.getSimpleName()) == null) { source.getAST().addImport(defaultImport.getSimpleName(), ClassHelper.make(defaultImport)); } } for (Class<?> defaultStaticImport : defaultStaticImports) { log.log(Level.FINE, "Adding default static import for class " + defaultStaticImport.getName()); if (!source.getAST().getStaticStarImports().containsKey(defaultStaticImport.getSimpleName())) { source.getAST().addStaticStarImport(defaultStaticImport.getSimpleName(), ClassHelper.make(defaultStaticImport)); } } } }
public void visit(ASTNode[] nodes, final SourceUnit source) { log.log(Level.FINE, "Transforming source to add default import package"); for (Class<?> defaultImport : defaultImports) { log.log(Level.FINE, "Adding default import for class " + defaultImport.getName()); if (source.getAST().getImport(defaultImport.getSimpleName()) == null) { source.getAST().addImport(defaultImport.getSimpleName(), ClassHelper.make(defaultImport)); } } for (Class<?> defaultStaticImport : defaultStaticImports) { log.log(Level.FINE, "Adding default static import for class " + defaultStaticImport.getName()); if (!source.getAST().getStaticStarImports().containsKey(defaultStaticImport.getSimpleName())) { source.getAST().addStaticStarImport(defaultStaticImport.getSimpleName(), ClassHelper.make(defaultStaticImport)); } } } }
public void visit(ASTNode[] nodes, final SourceUnit source) { log.log(Level.FINE, "Transforming source to add default import package"); for (Class<?> defaultImport : defaultImports) { log.log(Level.FINE, "Adding default import for class " + defaultImport.getName()); if (source.getAST().getImport(defaultImport.getSimpleName()) == null) { source.getAST().addImport(defaultImport.getSimpleName(), ClassHelper.make(defaultImport)); } } for (Class<?> defaultStaticImport : defaultStaticImports) { log.log(Level.FINE, "Adding default static import for class " + defaultStaticImport.getName()); if (!source.getAST().getStaticStarImports().containsKey(defaultStaticImport.getSimpleName())) { source.getAST().addStaticStarImport(defaultStaticImport.getSimpleName(), ClassHelper.make(defaultStaticImport)); } } } }
/** * Adds an import to the {@link ModuleNode} containing the {@link * ClassNode} passed as first argument. * * @param classNode the {@link ClassNode} where the import will be added * @param clazz the string representing the qualified class of the import * @since 0.3.0 */ public void addImport(final ClassNode classNode, final String clazz) { classNode.getModule().addImport(getClassNameFromString(clazz), ClassHelper.make(clazz)); }
@Override public void call(final SourceUnit source, final GeneratorContext context, final ClassNode classNode) throws CompilationFailedException { final ModuleNode ast = source.getAST(); for (Import anImport : imports) { switch (anImport.type) { case regular: ast.addImport(anImport.alias, anImport.classNode); break; case staticImport: ast.addStaticImport(anImport.classNode, anImport.field, anImport.alias); break; case staticStar: ast.addStaticStarImport(anImport.alias, anImport.classNode); break; case star: ast.addStarImport(anImport.star); break; } } }