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

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


        TypeDeclaration type = Find.type(tree, "Example");
        assertThat(type.getModelKind(), is(ModelKind.CLASS_DECLARATION));
        assertThat(Find.modifiers(type), hasItem(PUBLIC));

        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();
View Full Code Here


        private Expression addField(Type type, String name, Expression init) {
            assert type != null;
            assert name != null;
            SimpleName fieldName = createName(name);
            FieldDeclaration field = factory.newFieldDeclaration(
                    null,
                    new AttributeBuilder(factory)
                        .Private()
                        .toAttributes(),
                    type,
View Full Code Here

    public static FieldDeclaration field(TypeDeclaration type, String name) {
        for (TypeBodyDeclaration member : type.getBodyDeclarations()) {
            if (member.getModelKind() != ModelKind.FIELD_DECLARATION) {
                continue;
            }
            FieldDeclaration field = (FieldDeclaration) member;
            for (VariableDeclarator var : field.getVariableDeclarators()) {
                if (var.getName().getToken().equals(name)) {
                    return field;
                }
            }
        }
View Full Code Here

    }

    private FieldDeclaration createResourceField(ResourceFragment resource, SimpleName name) {
        assert resource != null;
        assert name != null;
        FieldDeclaration field = factory.newFieldDeclaration(
                null,
                new AttributeBuilder(factory)
                    .Private()
                    .toAttributes(),
                importer.toType(resource.getCompiled().getQualifiedName()),
View Full Code Here

                null);
        return field;
    }

    private FieldDeclaration createStageOutputsField() {
        FieldDeclaration field = factory.newFieldDeclaration(
                null,
                new AttributeBuilder(factory)
                    .Private()
                    .toAttributes(),
                importer.toType(StageOutputDriver.class),
View Full Code Here

            throw new IllegalStateException(type.toString());
        }
        Type dataType = importer.toType(model.getType());

        SimpleName cacheName = names.create("cache");
        FieldDeclaration cache = factory.newFieldDeclaration(
                null,
                new AttributeBuilder(factory)
                    .Private()
                    .toAttributes(),
                dataType,
View Full Code Here

TOP

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

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.