Package com.asakusafw.utils.java.model.syntax

Examples of com.asakusafw.utils.java.model.syntax.MethodDeclaration


            List<MethodDeclaration> results = Lists.create();
            results.add(createBegin(context.getBeginStatements()));
            results.add(createEnd(context.getEndStatements()));
            for (FlowElementInput input : fragment.getInputPorts()) {
                Segment segment = shuffle.findSegment(input);
                MethodDeclaration port = createPort(
                        PROCESS_PREFIX,
                        segment,
                        argument,
                        context.getProcessStatements(input.getDescription()));
                LOG.debug("セグメント{}のメソッドは{}として作成されます", segment, port.getName());
                results.add(port);
            }
            return results;
        }
View Full Code Here


            importer.resolvePackageMember(name);

            List<TypeBodyDeclaration> members = Lists.create();
            members.addAll(createFields());
            ConstructorDeclaration ctor = createConstructor();
            MethodDeclaration method = createBody();
            members.addAll(extraFields);
            members.add(ctor);
            members.add(method);
            return factory.newClassDeclaration(
                    createJavadoc(),
View Full Code Here

        FieldDeclaration field = Find.field(type, "out");
        assertThat(Find.modifiers(field), hasItems(PUBLIC, FINAL));
        assertThat(field.getType().toString(), is("Source<CharSequence>"));

        MethodDeclaration method = Find.method(tree, "example");
        assertThat(Find.modifiers(method), hasItem(PUBLIC));
        assertThat(method.getReturnType().toString(), is("SimpleFactory.Example"));
        List<? extends FormalParameterDeclaration> params = method.getFormalParameters();
        assertThat(params.size(), is(2));
        assertThat(params.get(0).getType().toString(), is("Source<String>"));
        assertThat(params.get(0).getName().getToken(), is("in"));
        assertThat(params.get(1).getType().toString(), is("int"));
        assertThat(params.get(1).getName().getToken(), is("param"));
View Full Code Here

        NamedType objectType = (NamedType) importer.resolvePackageMember(
                Models.append(factory,
                        getClassName(),
                        objectClass.getName()));
        MethodDeclaration factoryMethod = createFactoryMethod(objectType);
        if (factoryMethod != null) {
            results.add(factoryMethod);
        }

        return results;
View Full Code Here

    public static MethodDeclaration method(TypeDeclaration type, String name) {
        for (TypeBodyDeclaration member : type.getBodyDeclarations()) {
            if (member.getModelKind() != ModelKind.METHOD_DECLARATION) {
                continue;
            }
            MethodDeclaration method = (MethodDeclaration) member;
            if (method.getName().getToken().equals(name)) {
                return method;
            }
        }
        return null;
    }
View Full Code Here

                    .method(FlowElementProcessor.RESULT_METHOD_NAME, argumentName)
                    .toStatement());
            }
        }

        MethodDeclaration result = factory.newMethodDeclaration(
                null,
                new AttributeBuilder(factory)
                    .annotation(importer.toType(Override.class))
                    .Public()
                    .toAttributes(),
View Full Code Here

                    Collections.<FormalParameterDeclaration>emptyList(),
                    statements);
        }

        private MethodDeclaration createGetSupportedType() {
            MethodDeclaration decl = f.newMethodDeclaration(
                    null,
                    new AttributeBuilder(f)
                        .annotation(context.resolve(Override.class))
                        .Public()
                        .toAttributes(),
View Full Code Here

                .toLocalVariableDeclaration(context.resolve(CsvParser.class), parser));

            statements.add(new TypeBuilder(f, f.newNamedType(f.newSimpleName(NAME_READER)))
                .newObject(parser)
                .toReturnStatement());
            MethodDeclaration decl = f.newMethodDeclaration(
                    null,
                    new AttributeBuilder(f)
                        .annotation(context.resolve(Override.class))
                        .Public()
                        .toAttributes(),
View Full Code Here

            statements.add(new TypeBuilder(f, f.newNamedType(f.newSimpleName(NAME_WRITER)))
                .newObject(emitter)
                .toReturnStatement());

            MethodDeclaration decl = f.newMethodDeclaration(
                    null,
                    new AttributeBuilder(f)
                        .annotation(context.resolve(Override.class))
                        .Public()
                        .toAttributes(),
View Full Code Here

            if (context.element.getTypeParameters().isEmpty() == false) {
                objectType = new TypeBuilder(factory, objectType)
                        .parameterize(util.toTypeVariables(context.element))
                        .toType();
            }
            MethodDeclaration factoryMethod = createFactoryMethod(context, descriptor, objectType);
            if (factoryMethod == null) {
                continue;
            }

            results.add(objectClass);
View Full Code Here

TOP

Related Classes of com.asakusafw.utils.java.model.syntax.MethodDeclaration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.