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

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


                context.resolve(String.class),
                Models.toLiteral(f, value));
    }

    private MethodDeclaration createGetFormatMethod(Name value) {
        Type type = f.newParameterizedType(
                context.resolve(Class.class),
                f.newWildcard(WildcardBoundKind.UPPER_BOUNDED, f.newParameterizedType(
                        context.resolve(DataFormat.class), f.newWildcard())));
        return createGetMethod("getFormat", type, f.newClassLiteral(context.resolve(value))); //$NON-NLS-1$
    }
View Full Code Here


    private MethodDeclaration createIsOptionalMethod(boolean value) {
        return createGetMethod("isOptional", context.resolve(boolean.class), Models.toLiteral(f, value)); //$NON-NLS-1$
    }

    private MethodDeclaration createGetDataSizeMethod(DataSize value) {
        Type type = context.resolve(DataSize.class);
        return createGetMethod("getDataSize", type, new TypeBuilder(f, type) //$NON-NLS-1$
                .field(value.name())
                .toExpression());
    }
View Full Code Here

            members.add(createCache());
            members.addAll(fragments.createFields());
            members.add(createSetup());
            members.add(createCleanup());
            members.add(createRun());
            Type inputType = createInputType();
            return factory.newClassDeclaration(
                    createJavadoc(),
                    new AttributeBuilder(factory)
                        .annotation(t(TraceLocation.class), createTraceLocationElements())
                        .annotation(t(SuppressWarnings.class), v("deprecation"))
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

*/
public class ModelOutputDriver extends JavaDataModelDriver {

    @Override
    public List<Annotation> getTypeAnnotations(EmitContext context, ModelDeclaration model) throws IOException {
        Type type = generate(context, model);
        ModelFactory f = context.getModelFactory();
        return new AttributeBuilder(f)
            .annotation(context.resolve(ModelOutputLocation.class),
                    f.newClassLiteral(context.resolve(type)))
            .toAnnotations();
View Full Code Here

    }

    private MethodDeclaration createSetter(PropertyDeclaration property) {
        assert property != null;
        SimpleName paramName = context.createVariableName("value");
        Type valueType = context.getValueType(property);
        return f.newMethodDeclaration(
                new JavadocBuilder(f)
                    .text("{0}を設定する。",
                            context.getDescription(property))
                    .param(paramName)
View Full Code Here

    private MethodDeclaration createOptionSetter(PropertyDeclaration property) {
        assert property != null;
        SimpleName paramName = context.createVariableName("option");

        Type optionType = context.getFieldType(property);
        return f.newMethodDeclaration(
                new JavadocBuilder(f)
                    .text("{0}を設定する。",
                            context.getDescription(property))
                    .param(paramName)
View Full Code Here

                        .method("getClass") //$NON-NLS-1$
                        .toExpression())
                    .toExpression(),
                f.newBlock(f.newReturnStatement(Models.toLiteral(f, false)))));
        SimpleName other = context.createVariableName("other"); //$NON-NLS-1$
        Type self = context.resolve(context.getQualifiedTypeName());
        statements.add(new ExpressionBuilder(f, obj)
            .castTo(self)
            .toLocalVariableDeclaration(self, other));
        for (PropertyDeclaration property : model.getDeclaredProperties()) {
            SimpleName field = context.getFieldName(property);
View Full Code Here

*/
public class ModelInputDriver extends JavaDataModelDriver {

    @Override
    public List<Annotation> getTypeAnnotations(EmitContext context, ModelDeclaration model) throws IOException {
        Type type = generate(context, model);
        ModelFactory f = context.getModelFactory();
        return new AttributeBuilder(f)
            .annotation(context.resolve(ModelInputLocation.class),
                    f.newClassLiteral(context.resolve(type)))
            .toAnnotations();
View Full Code Here

    }

    private List<FieldDeclaration> createPropertyFields() {
        List<FieldDeclaration> results = Lists.create();
        for (PropertyDeclaration property : model.getDeclaredProperties()) {
            Type type = context.getFieldType(property);
            SimpleName name = context.getFieldName(property);
            results.add(f.newFieldDeclaration(
                    null,
                    new AttributeBuilder(f)
                        .Private()
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.