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

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


    }

    private Type getType(Type objectType) {
        assert objectType != null;
        assert objectType.getModelKind() != ModelKind.PARAMETERIZED_TYPE;
        Type type;
        if (flowClass.getElement().getTypeParameters().isEmpty()) {
            type = objectType;
        } else {
            type = new TypeBuilder(factory, objectType)
                .parameterize(util.toTypeVariables(flowClass.getElement()))
View Full Code Here


     */
    public FieldAccessExpression addModelObjectField(Type type, String name) {
        Precondition.checkMustNotBeNull(type, "type"); //$NON-NLS-1$
        Precondition.checkMustNotBeNull(name, "name"); //$NON-NLS-1$
        SimpleName fieldName = names.create(name);
        Type fieldType = importer.resolve(type);
        fields.add(factory.newFieldDeclaration(
                null,
                new AttributeBuilder(factory)
                    .Private()
                    .toAttributes(),
View Full Code Here

                .toLocalVariableDeclaration(t(List.class, t(StageInput.class)), list));
            statements.add(new ExpressionBuilder(factory, Models.toNullLiteral(factory))
                .toLocalVariableDeclaration(t(Map.class, t(String.class), t(String.class)), attributes));

            for (ResolvedSlot slot : slots) {
                Type mapperType = generateMapper(slot);
                statements.add(new ExpressionBuilder(factory, attributes)
                    .assignFrom(new TypeBuilder(factory, t(HashMap.class, t(String.class), t(String.class)))
                        .newObject()
                        .toExpression())
                    .toStatement());
View Full Code Here

            }

            // rendezvous
            for (Map.Entry<Fragment, SimpleName> entry : rendezvousNames.entrySet()) {
                Fragment fragment = entry.getKey();
                Type rendezvousType = importer.toType(fragment.getCompiled().getQualifiedName());
                List<Expression> arguments = Lists.create();
                for (FlowElementInput input : fragment.getInputPorts()) {
                    Segment segment = segments.get(input);
                    assert segment != null;
                    SimpleName shuffleName = shuffleNames.get(segment);
View Full Code Here

                    importer.toType(SortableSlot.class)));
            results.add(createClassLiteralMethod(
                    AbstractStageClient.METHOD_SHUFFLE_VALUE_CLASS,
                    importer.toType(WritableSlot.class)));
            if (doSort()) {
                Type reducer = generateReducer();
                results.add(createClassLiteralMethod(
                        AbstractStageClient.METHOD_PARTITIONER_CLASS,
                        importer.toType(SortableSlot.Partitioner.class)));
                results.add(createClassLiteralMethod(
                        AbstractStageClient.METHOD_REDUCER_CLASS,
View Full Code Here

        }

        private Type t(java.lang.reflect.Type type, Type...typeArgs) {
            assert type != null;
            assert typeArgs != null;
            Type raw = importer.toType(type);
            if (typeArgs.length == 0) {
                return raw;
            }
            return factory.newParameterizedType(raw, Arrays.asList(typeArgs));
        }
View Full Code Here

    }

    private FieldDeclaration createFragmentField(FragmentNode node, StageModel.Fragment value) {
        assert node != null;
        assert value != null;
        Type type = importer.resolve(factory.newNamedType(value.getCompiled().getQualifiedName()));
        return factory.newFieldDeclaration(
                null,
                new AttributeBuilder(factory)
                    .Private()
                    .toAttributes(),
View Full Code Here

    private Statement setupLine(FragmentNode node, StageModel.Fragment value) {
        assert node != null;
        assert value != null;
        assert value.getInputPorts().size() == 1;
        FlowElementInput input = value.getInputPorts().get(0);
        Type type = importer.resolve(factory.newNamedType(value.getCompiled().getQualifiedName()));
        List<Expression> arguments = resolveArguments(node, value);
        if (lines.containsKey(input)) {
            return new ExpressionBuilder(factory, factory.newThis())
                .field(node.getName())
                .assignFrom(new TypeBuilder(factory, type)
View Full Code Here

    private Statement setupRendezvous(FragmentNode node, StageModel.Fragment value) {
        assert node != null;
        assert value != null;
        assert value.getInputPorts().isEmpty() == false;
        FlowElement element = value.getInputPorts().get(0).getOwner();
        Type type = importer.resolve(factory.newNamedType(value.getCompiled().getQualifiedName()));
        List<Expression> arguments = resolveArguments(node, value);
        assert rendezvous.containsKey(element);
        return new ExpressionBuilder(factory, factory.newThis())
            .field(node.getName())
            .assignFrom(new TypeBuilder(factory, type)
View Full Code Here

        DataClass model = environment.getDataClasses().load(type);
        if (model == null) {
            throw new IllegalStateException(type.toString());
        }
        Type dataType = importer.toType(model.getType());

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

TOP

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

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.