com.github.javaparser.ast.NodeList Java Examples
The following examples show how to use
com.github.javaparser.ast.NodeList.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ImpSort.java From impsort-maven-plugin with Apache License 2.0 | 7 votes |
private static Set<String> tokensInUse(CompilationUnit unit) { // Extract tokens from the java code: Stream<Node> packageDecl = unit.getPackageDeclaration().isPresent() ? Stream.of(unit.getPackageDeclaration().get()).map(PackageDeclaration::getAnnotations) .flatMap(NodeList::stream) : Stream.empty(); Stream<String> typesInCode = Stream.concat(packageDecl, unit.getTypes().stream()) .map(Node::getTokenRange).filter(Optional::isPresent).map(Optional::get) .filter(r -> r != TokenRange.INVALID).flatMap(r -> { // get all JavaTokens as strings from each range return StreamSupport.stream(r.spliterator(), false); }).map(JavaToken::asString); // Extract referenced class names from parsed javadoc comments: Stream<String> typesInJavadocs = unit.getAllComments().stream() .filter(c -> c instanceof JavadocComment).map(JavadocComment.class::cast) .map(JavadocComment::parse).flatMap(ImpSort::parseJavadoc); return Stream.concat(typesInCode, typesInJavadocs) .filter(t -> t != null && !t.isEmpty() && Character.isJavaIdentifierStart(t.charAt(0))) .collect(Collectors.toSet()); }
Example #2
Source File: Extends.java From butterfly with MIT License | 6 votes |
@Override protected String getTypeName(CompilationUnit compilationUnit, int index) { ClassOrInterfaceDeclaration type = (ClassOrInterfaceDeclaration) compilationUnit.getType(0); NodeList<ClassOrInterfaceType> extendedTypes = type.getExtendedTypes(); ClassOrInterfaceType extendedType = extendedTypes.get(index); String typeSimpleName = extendedType.getName().getIdentifier(); Optional<ClassOrInterfaceType> scope = extendedType.getScope(); String typeName; if (scope.isPresent()) { String typePackageName = scope.get().toString(); typeName = String.format("%s.%s", typePackageName, typeSimpleName); } else { typeName = typeSimpleName; } return typeName; }
Example #3
Source File: ProcessesContainerGenerator.java From kogito-runtimes with Apache License 2.0 | 6 votes |
@Override public CompilationUnit injectableClass() { CompilationUnit compilationUnit = parse(this.getClass().getResourceAsStream(RESOURCE)).setPackageDeclaration(packageName); ClassOrInterfaceDeclaration cls = compilationUnit .findFirst(ClassOrInterfaceDeclaration.class) .orElseThrow(() -> new NoSuchElementException("Compilation unit doesn't contain a class or interface declaration!")); cls.findAll(FieldDeclaration.class, fd -> fd.getVariable(0).getNameAsString().equals("processes")).forEach(fd -> { annotator.withInjection(fd); fd.getVariable(0).setType(new ClassOrInterfaceType(null, new SimpleName(annotator.multiInstanceInjectionType()), NodeList.nodeList(new ClassOrInterfaceType(null, new SimpleName(org.kie.kogito.process.Process.class.getCanonicalName()), NodeList.nodeList(new WildcardType(new ClassOrInterfaceType(null, Model.class.getCanonicalName()))))))); }); annotator.withApplicationComponent(cls); return compilationUnit; }
Example #4
Source File: ParserTypeUtil.java From JRemapper with MIT License | 6 votes |
/** * @param md * JavaParser method declaration. * @return Internal descriptor from declaration, or {@code null} if any parsing * failures occured. */ private static String getMethodDesc(MethodDeclaration md) { StringBuilder sbDesc = new StringBuilder("("); // Append the method parameters for the descriptor NodeList<Parameter> params = md.getParameters(); for (Parameter param : params) { Type pType = param.getType(); String pDesc = getDescriptor(pType); if (pDesc == null) return null; sbDesc.append(pDesc); } // Append the return type for the descriptor Type typeRet = md.getType(); String retDesc = getDescriptor(typeRet); if (retDesc == null) return null; sbDesc.append(")"); sbDesc.append(retDesc); return sbDesc.toString(); }
Example #5
Source File: ProcessesContainerGenerator.java From kogito-runtimes with Apache License 2.0 | 6 votes |
public ProcessesContainerGenerator(String packageName) { super("Processes", "processes", Processes.class); this.packageName = packageName; this.processes = new ArrayList<>(); this.factoryMethods = new ArrayList<>(); this.applicationDeclarations = new NodeList<>(); byProcessIdMethodDeclaration = new MethodDeclaration() .addModifier(Modifier.Keyword.PUBLIC) .setName("processById") .setType(new ClassOrInterfaceType(null, org.kie.kogito.process.Process.class.getCanonicalName()) .setTypeArguments(new WildcardType(new ClassOrInterfaceType(null, Model.class.getCanonicalName())))) .setBody(new BlockStmt()) .addParameter("String", "processId"); processesMethodDeclaration = new MethodDeclaration() .addModifier(Modifier.Keyword.PUBLIC) .setName("processIds") .setType(new ClassOrInterfaceType(null, Collection.class.getCanonicalName()) .setTypeArguments(new ClassOrInterfaceType(null, "String"))) .setBody(new BlockStmt()); applicationDeclarations.add(byProcessIdMethodDeclaration); applicationDeclarations.add(processesMethodDeclaration); }
Example #6
Source File: ProcessGenerator.java From kogito-runtimes with Apache License 2.0 | 6 votes |
private MethodDeclaration createInstanceWithBusinessKeyMethod(String processInstanceFQCN) { MethodDeclaration methodDeclaration = new MethodDeclaration(); ReturnStmt returnStmt = new ReturnStmt( new ObjectCreationExpr() .setType(processInstanceFQCN) .setArguments(NodeList.nodeList( new ThisExpr(), new NameExpr("value"), new NameExpr(BUSINESS_KEY), createProcessRuntime()))); methodDeclaration.setName("createInstance") .addModifier(Modifier.Keyword.PUBLIC) .addParameter(String.class.getCanonicalName(), BUSINESS_KEY) .addParameter(modelTypeName, "value") .setType(processInstanceFQCN) .setBody(new BlockStmt() .addStatement(returnStmt)); return methodDeclaration; }
Example #7
Source File: ProcessGenerator.java From kogito-runtimes with Apache License 2.0 | 6 votes |
private MethodDeclaration createInstanceMethod(String processInstanceFQCN) { MethodDeclaration methodDeclaration = new MethodDeclaration(); ReturnStmt returnStmt = new ReturnStmt( new ObjectCreationExpr() .setType(processInstanceFQCN) .setArguments(NodeList.nodeList( new ThisExpr(), new NameExpr("value"), createProcessRuntime()))); methodDeclaration.setName("createInstance") .addModifier(Modifier.Keyword.PUBLIC) .addParameter(modelTypeName, "value") .setType(processInstanceFQCN) .setBody(new BlockStmt() .addStatement(returnStmt)); return methodDeclaration; }
Example #8
Source File: RuleConfigGenerator.java From kogito-runtimes with Apache License 2.0 | 6 votes |
private MethodDeclaration generateMergeEventListenerConfigMethod() { BlockStmt body = new BlockStmt().addStatement(new ReturnStmt(newObject(CachedRuleEventListenerConfig.class, callMerge( VAR_RULE_EVENT_LISTENER_CONFIGS, RuleEventListenerConfig.class, "agendaListeners", VAR_AGENDA_EVENT_LISTENERS ), callMerge( VAR_RULE_EVENT_LISTENER_CONFIGS, RuleEventListenerConfig.class, "ruleRuntimeListeners", VAR_RULE_RUNTIME_EVENT_LISTENERS ) ))); return method(Modifier.Keyword.PRIVATE, RuleEventListenerConfig.class, METHOD_MERGE_RULE_EVENT_LISTENER_CONFIG, NodeList.nodeList( new Parameter().setType(genericType(Collection.class, RuleEventListenerConfig.class)).setName(VAR_RULE_EVENT_LISTENER_CONFIGS), new Parameter().setType(genericType(Collection.class, AgendaEventListener.class)).setName(VAR_AGENDA_EVENT_LISTENERS), new Parameter().setType(genericType(Collection.class, RuleRuntimeEventListener.class)).setName(VAR_RULE_RUNTIME_EVENT_LISTENERS) ), body); }
Example #9
Source File: DecisionContainerGenerator.java From kogito-runtimes with Apache License 2.0 | 6 votes |
@Override public List<Statement> setupStatements() { return Collections.singletonList( new IfStmt( new BinaryExpr( new MethodCallExpr(new MethodCallExpr(null, "config"), "decision"), new NullLiteralExpr(), BinaryExpr.Operator.NOT_EQUALS ), new BlockStmt().addStatement(new ExpressionStmt(new MethodCallExpr( new NameExpr("decisionModels"), "init", NodeList.nodeList(new ThisExpr()) ))), null ) ); }
Example #10
Source File: GroovydocJavaVisitor.java From groovy with Apache License 2.0 | 6 votes |
private void setConstructorOrMethodCommon(CallableDeclaration<? extends CallableDeclaration<?>> n, SimpleGroovyExecutableMemberDoc methOrCons) { n.getJavadocComment().ifPresent(javadocComment -> methOrCons.setRawCommentText(javadocComment.getContent())); NodeList<Modifier> mods = n.getModifiers(); if (currentClassDoc.isInterface()) { mods.add(Modifier.publicModifier()); } setModifiers(mods, methOrCons); processAnnotations(methOrCons, n); for (Parameter param : n.getParameters()) { SimpleGroovyParameter p = new SimpleGroovyParameter(param.getNameAsString()); processAnnotations(p, param); p.setType(makeType(param.getType())); methOrCons.add(p); } }
Example #11
Source File: GroovydocJavaVisitor.java From groovy with Apache License 2.0 | 6 votes |
private SimpleGroovyClassDoc visit(TypeDeclaration<?> n) { SimpleGroovyClassDoc parent = null; List<String> imports = getImports(); String name = n.getNameAsString(); if (n.isNestedType()) { parent = currentClassDoc; name = parent.name() + "$" + name; } currentClassDoc = new SimpleGroovyClassDoc(imports, aliases, name.replace('$', '.'), links); NodeList<Modifier> mods = n.getModifiers(); if (parent != null) { parent.addNested(currentClassDoc); if (parent.isInterface()) { // an inner interface/class within an interface is public mods.add(Modifier.publicModifier()); } } setModifiers(mods, currentClassDoc); processAnnotations(currentClassDoc, n); currentClassDoc.setFullPathName(withSlashes(packagePath + FS + name)); classDocs.put(currentClassDoc.getFullPathName(), currentClassDoc); n.getJavadocComment().ifPresent(javadocComment -> currentClassDoc.setRawCommentText(javadocComment.getContent())); return parent; }
Example #12
Source File: JavaParserUtil.java From Recaf with MIT License | 6 votes |
/** * @param md * JavaParser method declaration. * @return Internal descriptor from declaration, or {@code null} if any parsing * failures occured. */ public static String getDescriptor(MethodDeclaration md) { StringBuilder sbDesc = new StringBuilder("("); // Append the method parameters for the descriptor NodeList<Parameter> params = md.getParameters(); for (Parameter param : params) { Type pType = param.getType(); String pDesc = getDescriptor(pType); if (pDesc == null) return null; sbDesc.append(pDesc); } // Append the return type for the descriptor Type typeRet = md.getType(); String retDesc = getDescriptor(typeRet); if (retDesc == null) return null; sbDesc.append(")"); sbDesc.append(retDesc); return sbDesc.toString(); }
Example #13
Source File: QueryEndpointGenerator.java From kogito-runtimes with Apache License 2.0 | 6 votes |
private BlockStmt wrapBodyAddingExceptionLogging(BlockStmt body, String nameURL) { TryStmt ts = new TryStmt(); ts.setTryBlock(body); CatchClause cc = new CatchClause(); String exceptionName = "e"; cc.setParameter(new Parameter().setName(exceptionName).setType(Exception.class)); BlockStmt cb = new BlockStmt(); cb.addStatement(parseStatement( String.format( "SystemMetricsCollector.registerException(\"%s\", %s.getStackTrace()[0].toString());", nameURL, exceptionName) )); cb.addStatement(new ThrowStmt(new NameExpr(exceptionName))); cc.setBody(cb); ts.setCatchClauses(new NodeList<>(cc)); return new BlockStmt(new NodeList<>(ts)); }
Example #14
Source File: RuleSetNodeVisitor.java From kogito-runtimes with Apache License 2.0 | 6 votes |
private MethodCallExpr handleRuleFlowGroup(RuleSetNode.RuleType ruleType) { // build supplier for rule runtime BlockStmt actionBody = new BlockStmt(); LambdaExpr lambda = new LambdaExpr(new Parameter(new UnknownType(), "()"), actionBody); MethodCallExpr ruleRuntimeBuilder = new MethodCallExpr( new MethodCallExpr(new NameExpr("app"), "ruleUnits"), "ruleRuntimeBuilder"); MethodCallExpr ruleRuntimeSupplier = new MethodCallExpr( ruleRuntimeBuilder, "newKieSession", NodeList.nodeList(new StringLiteralExpr("defaultStatelessKieSession"), new NameExpr("app.config().rule()"))); actionBody.addStatement(new ReturnStmt(ruleRuntimeSupplier)); return new MethodCallExpr("ruleFlowGroup") .addArgument(new StringLiteralExpr(ruleType.getName())) .addArgument(lambda); }
Example #15
Source File: GroovydocJavaVisitor.java From groovy with Apache License 2.0 | 6 votes |
private void setModifiers(NodeList<Modifier> modifiers, SimpleGroovyAbstractableElementDoc elementDoc) { if (modifiers.contains(Modifier.publicModifier())) { elementDoc.setPublic(true); } if (modifiers.contains(Modifier.staticModifier())) { elementDoc.setStatic(true); } if (modifiers.contains(Modifier.abstractModifier())) { elementDoc.setAbstract(true); } if (modifiers.contains(Modifier.finalModifier())) { elementDoc.setFinal(true); } if (modifiers.contains(Modifier.protectedModifier())) { elementDoc.setProtected(true); } if (modifiers.contains(Modifier.privateModifier())) { elementDoc.setPrivate(true); } }
Example #16
Source File: SourceCodeProcessHandler.java From molicode with Apache License 2.0 | 6 votes |
@Override public void visit(FieldDeclaration n, Void arg) { if (n.isFinal() || n.isStatic()) { return; } NodeList<VariableDeclarator> nodeList = n.getVariables(); for (VariableDeclarator declarator : nodeList) { FieldInfoDto fieldInfoDto = new FieldInfoDto(); fieldInfoDto.setDataName(declarator.getNameAsString()); fieldInfoDto.setFieldClass(declarator.getType().asString()); Optional<Comment> commentOptional = n.getComment(); if (commentOptional.isPresent()) { String commentContent = commentOptional.get().getContent(); commentContent = commentContent.replaceAll("\\*", ""); fieldInfoDto.setComment(commentContent.trim()); } else { fieldInfoDto.setComment(fieldInfoDto.getDataName()); } sourceCodeDto.addField(fieldInfoDto); } sourceCodeDto.addFieldDeclaration(n); super.visit(n, arg); }
Example #17
Source File: GeneralFixture.java From TestSmellDetector with GNU General Public License v3.0 | 5 votes |
@Override public void runAnalysis(CompilationUnit testFileCompilationUnit, CompilationUnit productionFileCompilationUnit, String testFileName, String productionFileName) throws FileNotFoundException { GeneralFixture.ClassVisitor classVisitor; classVisitor = new GeneralFixture.ClassVisitor(); classVisitor.visit(testFileCompilationUnit, null); //This call will populate the list of test methods and identify the setup method [visit(ClassOrInterfaceDeclaration n)] //Proceed with general fixture analysis if setup method exists if (setupMethod != null) { //Get all fields that are initialized in the setup method //The following code block will identify the class level variables (i.e. fields) that are initialized in the setup method // TODO: There has to be a better way to do this identification/check! Optional<BlockStmt> blockStmt = setupMethod.getBody(); NodeList nodeList = blockStmt.get().getStatements(); for (int i = 0; i < nodeList.size(); i++) { for (int j = 0; j < fieldList.size(); j++) { for (int k = 0; k < fieldList.get(j).getVariables().size(); k++) { if (nodeList.get(i) instanceof ExpressionStmt) { ExpressionStmt expressionStmt = (ExpressionStmt) nodeList.get(i); if (expressionStmt.getExpression() instanceof AssignExpr) { AssignExpr assignExpr = (AssignExpr) expressionStmt.getExpression(); if (fieldList.get(j).getVariable(k).getNameAsString().equals(assignExpr.getTarget().toString())) { setupFields.add(assignExpr.getTarget().toString()); } } } } } } } for (MethodDeclaration method : methodList) { //This call will visit each test method to identify the list of variables the method contains [visit(MethodDeclaration n)] classVisitor.visit(method, null); } }
Example #18
Source File: RequestMappingHelper.java From apigcc with MIT License | 5 votes |
/** * 获取headers * @param nodeList * @return */ public static List<String> pickHeaders(NodeList<AnnotationExpr> nodeList){ for (AnnotationExpr annotationExpr : nodeList) { if(ANNOTATION_REQUEST_MAPPINGS.contains(annotationExpr.getNameAsString())){ Optional<Expression> expressionOptional = AnnotationHelper.attr(annotationExpr, "headers"); if (expressionOptional.isPresent()) { Expression expression = expressionOptional.get(); return ExpressionHelper.getStringValues(expression); } } } return Lists.newArrayList(); }
Example #19
Source File: ClassParser.java From Briefness with Apache License 2.0 | 5 votes |
private static String[] checkAnnatation(NodeList<AnnotationExpr> annotationExprs) { for (AnnotationExpr annotationExpr : annotationExprs) { if (annotationExpr.toString().contains(BindLayout) || annotationExpr.toString().contains(BindView) || annotationExpr.toString().contains(BindClick)) return subString(annotationExpr.toString().replaceAll("R2", "R")).split(","); } return null; }
Example #20
Source File: RequestMappingHelper.java From apigcc with MIT License | 5 votes |
/** * 获取uri数据,有多个时,暂时只取第一个 * @param nodeList * @return */ public static String pickUri(NodeList<AnnotationExpr> nodeList){ for (AnnotationExpr annotationExpr : nodeList) { if(ANNOTATION_REQUEST_MAPPINGS.contains(annotationExpr.getNameAsString())){ Optional<Expression> expressionOptional = AnnotationHelper.attr(annotationExpr, "value","path"); if (expressionOptional.isPresent()) { Expression expression = expressionOptional.get(); return ExpressionHelper.getStringValue(expression); } } } return ""; }
Example #21
Source File: ClassParser.java From Briefness with Apache License 2.0 | 5 votes |
private static Immersive checkImmersive(NodeList<AnnotationExpr> annotationExprs) { for (AnnotationExpr annotationExpr : annotationExprs) { if (annotationExpr.getNameAsString().equals(Immersive)) { String annotation = annotationExpr.toString(); if (!annotation.contains("(")) return new Immersive(); String content = annotation.substring(annotation.indexOf("(") + 1, annotation.indexOf(")")).replaceAll(" ", ""); Immersive im = new Immersive(); if (content.length() > 4) { String values[] = content.split(","); for (String value : values) { String[] kv = value.split("="); if (kv[0].equals(Immersive_statusColor)) { im.setStatusColor(kv[1]); } else if (kv[0].equals(Immersive_navigationColor)) { im.setNavigationColor(kv[1]); } else if (kv[0].equals(Immersive_statusEmbed)) { im.setStatusEmbed(kv[1]); } else if (kv[0].equals(Immersive_navigationEmbed)) { im.setNavigationEmbed(kv[1]); } } } return im; } } return null; }
Example #22
Source File: PrettyPrintVisitor.java From stategen with GNU Affero General Public License v3.0 | 5 votes |
private void printTypeArgs(final NodeWithTypeArguments<?> nodeWithTypeArguments, final Void arg) { NodeList<Type> typeArguments = nodeWithTypeArguments.getTypeArguments().orElse(null); if (!isNullOrEmpty(typeArguments)) { printer.print("<"); for (final Iterator<Type> i = typeArguments.iterator(); i.hasNext(); ) { final Type t = i.next(); t.accept(this, arg); if (i.hasNext()) { printer.print(", "); } } printer.print(">"); } }
Example #23
Source File: MigrateJCas.java From uima-uimaj with Apache License 2.0 | 5 votes |
/** * Unwrap (possibly nested) 1 statement blocks * @param stmt - * @return unwrapped (non- block) statement */ private Statement getStmtFromStmt(Statement stmt) { while (stmt instanceof BlockStmt) { NodeList<Statement> stmts = ((BlockStmt) stmt).getStatements(); if (stmts.size() == 1) { stmt = stmts.get(0); continue; } return null; } return stmt; }
Example #24
Source File: JavaInterfaceBuilderImpl.java From chrome-devtools-java-client with Apache License 2.0 | 5 votes |
@Override public void addParametrizedMethodAnnotation( String methodName, String annotationName, String parameter) { List<MethodDeclaration> methods = declaration.getMethodsByName(methodName); for (MethodDeclaration methodDeclaration : methods) { Optional<AnnotationExpr> annotation = methodDeclaration.getAnnotationByName(annotationName); if (!annotation.isPresent()) { if (isClassList(parameter)) { final List<String> classList = getClassList(parameter); if (classList.size() == 1) { methodDeclaration.addSingleMemberAnnotation( annotationName, new ClassExpr(new ClassOrInterfaceType(getClassName(classList.get(0))))); } else { final List<Expression> nodes = classList .stream() .map(clazz -> new ClassExpr(new ClassOrInterfaceType(getClassName(clazz)))) .collect(Collectors.toList()); methodDeclaration.addSingleMemberAnnotation( annotationName, new ArrayInitializerExpr(new NodeList<>(nodes))); } } else { methodDeclaration.addSingleMemberAnnotation( annotationName, new StringLiteralExpr(parameter)); } } } importAnnotation(annotationName); }
Example #25
Source File: CompilationUnitUtils.java From chrome-devtools-java-client with Apache License 2.0 | 5 votes |
/** * Checks if given name is already imported on compilation unit. * * @param compilationUnit Compilation unit. * @param name Name to check for. * @return True if name is already imported. */ public static boolean isImported(CompilationUnit compilationUnit, Name name) { NodeList<ImportDeclaration> imports = compilationUnit.getImports(); if (CollectionUtils.isNotEmpty(imports)) { for (ImportDeclaration importDeclaration : imports) { if (name.equals(importDeclaration.getName())) { return true; } } } return false; }
Example #26
Source File: PrettyPrintVisitor.java From stategen with GNU Affero General Public License v3.0 | 5 votes |
@Override public void visit(LambdaExpr n, Void arg) { printJavaComment(n.getComment(), arg); final NodeList<Parameter> parameters = n.getParameters(); final boolean printPar = n.isEnclosingParameters(); if (printPar) { printer.print("("); } for (Iterator<Parameter> i = parameters.iterator(); i.hasNext(); ) { Parameter p = i.next(); p.accept(this, arg); if (i.hasNext()) { printer.print(", "); } } if (printPar) { printer.print(")"); } printer.print(" -> "); final Statement body = n.getBody(); if (body instanceof ExpressionStmt) { // Print the expression directly ((ExpressionStmt) body).getExpression().accept(this, arg); } else { body.accept(this, arg); } }
Example #27
Source File: ModuleGenerator.java From selenium with Apache License 2.0 | 5 votes |
private int getByteBuddyModifier(NodeList<Modifier> modifiers) { return modifiers.stream() .mapToInt(mod -> { if (mod.getKeyword() == Modifier.Keyword.TRANSITIVE) { return ACC_TRANSITIVE; } throw new RuntimeException("Unknown modifier: " + mod); }) .reduce(0, (l, r) -> l | r); }
Example #28
Source File: PrettyPrintVisitor.java From stategen with GNU Affero General Public License v3.0 | 5 votes |
private void printPrePostFixOptionalList(final NodeList<? extends Visitable> args, final Void arg, String prefix, String separator, String postfix) { if (!args.isEmpty()) { printer.print(prefix); for (final Iterator<? extends Visitable> i = args.iterator(); i.hasNext(); ) { final Visitable v = i.next(); v.accept(this, arg); if (i.hasNext()) { printer.print(separator); } } printer.print(postfix); } }
Example #29
Source File: PrettyPrintVisitor.java From stategen with GNU Affero General Public License v3.0 | 5 votes |
private void printArguments(final NodeList<Expression> args, final Void arg) { printer.print("("); if (!isNullOrEmpty(args)) { for (final Iterator<Expression> i = args.iterator(); i.hasNext(); ) { final Expression e = i.next(); e.accept(this, arg); if (i.hasNext()) { printer.print(", "); } } } printer.print(")"); }
Example #30
Source File: RuleUnitMetaModel.java From kogito-runtimes with Apache License 2.0 | 5 votes |
public NodeList<Statement> hoistVars() { NodeList<Statement> statements = new NodeList<>(); for (RuleUnitVariable v : ruleUnitDescription.getUnitVarDeclarations()) { statements.add(new ExpressionStmt(assignVar(v))); } return statements; }