com.github.javaparser.ast.expr.ClassExpr Java Examples
The following examples show how to use
com.github.javaparser.ast.expr.ClassExpr.
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: AnnotatedMember.java From jeddict with Apache License 2.0 | 6 votes |
static List<String> getClassNameAttributes(AnnotationExpr annotationExpr, String attributeName) { List<String> values = new ArrayList<>(); Optional<Expression> expOptional = getAttribute(annotationExpr, attributeName); if (expOptional.isPresent()) { Expression expression = expOptional.get(); if (expression.isClassExpr()) { values.add(expression.asClassExpr().getTypeAsString()); } else if (expression.isArrayInitializerExpr()) { for (Node node : expression.asArrayInitializerExpr().getChildNodes()) { if (node instanceof ClassExpr) { values.add(((ClassExpr) node).getTypeAsString()); } else { throw new UnsupportedOperationException(); } } } else { throw new UnsupportedOperationException(); } } return values; }
Example #2
Source File: AppendRoutingVisitor.java From enkan with Eclipse Public License 1.0 | 5 votes |
public void visit(final BlockStmt n, final RoutingDefineContext arg) { if (arg.isInRoutingDefine()) { MethodCallExpr call = new MethodCallExpr( ASTHelper.createNameExpr(arg.getRoutingParameter().getId().getName()), "resource"); ReferenceType rt = ASTHelper.createReferenceType(controllerClassName, 0); ASTHelper.addArgument(call, new ClassExpr(rt.getType())); ASTHelper.addStmt(n, call); } else { super.visit(n, arg); } }
Example #3
Source File: RuleUnitHandler.java From kogito-runtimes with Apache License 2.0 | 4 votes |
private BlockStmt unit(String unitName) { MethodCallExpr ruleUnit = new MethodCallExpr( new MethodCallExpr(new NameExpr("app"), "ruleUnits"), "create") .addArgument(new ClassExpr().setType(unitName)); return new BlockStmt().addStatement(new ReturnStmt(ruleUnit)); }
Example #4
Source File: PrettyPrintVisitor.java From stategen with GNU Affero General Public License v3.0 | 4 votes |
@Override public void visit(final ClassExpr n, final Void arg) { printJavaComment(n.getComment(), arg); n.getType().accept(this, arg); printer.print(".class"); }
Example #5
Source File: AnnotatedMember.java From jeddict with Apache License 2.0 | 4 votes |
static Optional<Type> getTypeClassAttribute(AnnotationExpr annotationExpr, String attributeName) { return getAttribute(annotationExpr, attributeName) .map(Expression::asClassExpr) .map(ClassExpr::getType); }
Example #6
Source File: JavaParsingAtomicQueueGenerator.java From JCTools with Apache License 2.0 | 4 votes |
protected MethodCallExpr newAtomicLongFieldUpdater(String className, String variableName) { return methodCallExpr("AtomicLongFieldUpdater", "newUpdater", new ClassExpr(classType(className)), new StringLiteralExpr(variableName)); }
Example #7
Source File: TraceVisitor.java From JCTools with Apache License 2.0 | 4 votes |
@Override public void visit(ClassExpr n, Void arg) { out.println("ClassExpr: " + (extended ? n : n.getType())); super.visit(n, arg); }
Example #8
Source File: JavaParsingAtomicLinkedQueueGenerator.java From JCTools with Apache License 2.0 | 4 votes |
private MethodCallExpr newAtomicRefFieldUpdater(String className, String variableName) { return methodCallExpr("AtomicReferenceFieldUpdater", "newUpdater", new ClassExpr(classType(className)), new ClassExpr(classType("LinkedQueueAtomicNode")), new StringLiteralExpr(variableName)); }
Example #9
Source File: ClassExprMerger.java From dolphin with Apache License 2.0 | 3 votes |
@Override public ClassExpr doMerge(ClassExpr first, ClassExpr second) { ClassExpr ce = new ClassExpr(); ce.setType(mergeSingle(first.getType(),second.getType())); return ce; }
Example #10
Source File: ClassExprMerger.java From dolphin with Apache License 2.0 | 2 votes |
@Override public boolean doIsEquals(ClassExpr first, ClassExpr second) { if(!isEqualsUseMerger(first.getType(),second.getType())) return false; return true; }