com.github.javaparser.ast.type.VoidType Java Examples

The following examples show how to use com.github.javaparser.ast.type.VoidType. 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: ProcessInstanceGenerator.java    From kogito-runtimes with Apache License 2.0 6 votes vote down vote up
private MethodDeclaration unbind() {
    String modelName = model.getModelClassSimpleName();
    BlockStmt body = new BlockStmt()
            .addStatement(model.fromMap("variables", "vmap"));

    return new MethodDeclaration()
            .setModifiers(Modifier.Keyword.PROTECTED)
            .setName("unbind")
            .setType(new VoidType())
            .addParameter(modelName, "variables")
            .addParameter(new ClassOrInterfaceType()
                                  .setName("java.util.Map")
                                  .setTypeArguments(new ClassOrInterfaceType().setName("String"),
                                                    new ClassOrInterfaceType().setName("Object")),
                          "vmap")
            .setBody(body);
}
 
Example #2
Source File: FormTask.java    From enkan with Eclipse Public License 1.0 6 votes vote down vote up
private MethodDeclaration setterDeclaration(EntityField field) {
    MethodDeclaration decl = new MethodDeclaration(ModifierSet.PUBLIC,
            new VoidType(),
            "set" + CaseConverter.pascalCase(field.getName()),
            Collections.singletonList(new Parameter(
                    ASTHelper.createReferenceType(field.getType().getSimpleName(), 0),
                    new VariableDeclaratorId(field.getName()))));

    BlockStmt body = new BlockStmt();
    body.setStmts(
            Collections.singletonList(
                    new ExpressionStmt(
                            new AssignExpr(
                                    new FieldAccessExpr(new ThisExpr(), field.getName()),
                                    ASTHelper.createNameExpr(field.getName()),
                                    AssignExpr.Operator.assign
                            ))));
    decl.setBody(body);
    return decl;
}
 
Example #3
Source File: Sources.java    From sundrio with Apache License 2.0 6 votes vote down vote up
public TypeRef apply(Type type) {
    if (type instanceof VoidType) {
        return new VoidRef();
    } else if (type instanceof WildcardType) {
        return new WildcardRef();
    } else if (type instanceof ReferenceType) {
        ReferenceType referenceType = (ReferenceType) type;
        int dimensions = referenceType.getArrayCount();
        TypeRef typeRef = TYPEREF.apply(referenceType.getType());
        if (dimensions == 0) {
            return typeRef;
        } else if (typeRef instanceof ClassRef) {
            return new ClassRefBuilder((ClassRef)typeRef).withDimensions(dimensions).build();
        } else if (typeRef instanceof PrimitiveRef) {
            return new PrimitiveRefBuilder((PrimitiveRef)typeRef).withDimensions(dimensions).build();
        } else if (typeRef instanceof TypeParamRef) {
            return new TypeParamRefBuilder((TypeParamRef)typeRef).withDimensions(dimensions).build();
        }
    } else if (type instanceof PrimitiveType) {
        PrimitiveType primitiveType = (PrimitiveType) type;
        return new PrimitiveRefBuilder().withName(primitiveType.getType().name()).build();
    } else if (type instanceof ClassOrInterfaceType) {
        return CLASS_OR_TYPEPARAM_REF.apply((ClassOrInterfaceType) type);
    }
    throw new IllegalArgumentException("Can't handle type:[" + type + "].");
}
 
Example #4
Source File: VoidTypeMerger.java    From dolphin with Apache License 2.0 5 votes vote down vote up
@Override
public VoidType doMerge(VoidType first, VoidType second) {
  VoidType vt = new VoidType();

  vt.setAnnotations(mergeCollections(first.getAnnotations(),second.getAnnotations()));

  return vt;
}
 
Example #5
Source File: PrettyPrintVisitor.java    From stategen with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public void visit(final VoidType n, final Void arg) {
    printJavaComment(n.getComment(), arg);
    printAnnotations(n.getAnnotations(), false, arg);
    printer.print("void");
}
 
Example #6
Source File: VoidTypeMerger.java    From dolphin with Apache License 2.0 4 votes vote down vote up
@Override
public boolean doIsEquals(VoidType first, VoidType second) {

  return true;
}
 
Example #7
Source File: TraceVisitor.java    From JCTools with Apache License 2.0 4 votes vote down vote up
@Override
public void visit(VoidType n, Void arg) {
    out.println("VoidType: " + (extended ? n : ""));
    super.visit(n, arg);
}