Examples of AstLiteral


Examples of com.asakusafw.dmdl.model.AstLiteral

    private Configuration analyzeConfig(
            DmdlSemantics environment,
            AstAttribute attribute,
            Map<String, AstAttributeElement> elements) {
        AstLiteral charset = take(environment, elements, ELEMENT_CHARSET_NAME, LiteralKind.STRING);
        AstLiteral header = take(environment, elements, ELEMENT_HAS_HEADER_NAME, LiteralKind.BOOLEAN);
        AstLiteral trueRep = take(environment, elements, ELEMENT_TRUE_NAME, LiteralKind.STRING);
        AstLiteral falseRep = take(environment, elements, ELEMENT_FALSE_NAME, LiteralKind.STRING);
        AstLiteral dateFormat = take(environment, elements, ELEMENT_DATE_NAME, LiteralKind.STRING);
        AstLiteral dateTimeFormat = take(environment, elements, ELEMENT_DATE_TIME_NAME, LiteralKind.STRING);
        environment.reportAll(AttributeUtil.reportInvalidElements(attribute, elements.values()));

        Configuration result = new Configuration();
        if (charset != null && checkNotEmpty(environment, ELEMENT_CHARSET_NAME, charset)) {
            result.setCharsetName(charset.toStringValue());
        }
        if (header != null) {
            result.setEnableHeader(header.toBooleanValue());
        }
        if (trueRep != null && checkNotEmpty(environment, ELEMENT_TRUE_NAME, trueRep)) {
            result.setTrueFormat(trueRep.toStringValue());
        }
        if (falseRep != null && checkNotEmpty(environment, ELEMENT_FALSE_NAME, falseRep)) {
            result.setFalseFormat(falseRep.toStringValue());
        }
        if (dateFormat != null && checkDateFormat(environment, ELEMENT_DATE_NAME, dateFormat)) {
            result.setDateFormat(dateFormat.toStringValue());
        }
        if (dateTimeFormat != null && checkDateFormat(environment, ELEMENT_DATE_TIME_NAME, dateTimeFormat)) {
            result.setDateTimeFormat(dateTimeFormat.toStringValue());
        }
        return result;
    }
View Full Code Here

Examples of com.asakusafw.dmdl.model.AstLiteral

                    TARGET_NAME,
                    elementName,
                    kind));
            return null;
        } else {
            AstLiteral literal = (AstLiteral) element.value;
            if (literal.kind != kind) {
                environment.report(new Diagnostic(
                        Level.ERROR,
                        element,
                        Messages.getString("CsvSupportDriver.diagnosticInvalidLiteralKind"), //$NON-NLS-1$
View Full Code Here

Examples of com.asakusafw.dmdl.model.AstLiteral

    private Configuration analyzeConfig(
            DmdlSemantics environment,
            AstAttribute attribute,
            Map<String, AstAttributeElement> elements) {
        AstLiteral charset = take(environment, elements, ELEMENT_CHARSET_NAME, LiteralKind.STRING);
        AstLiteral header = take(environment, elements, ELEMENT_HAS_HEADER_NAME, LiteralKind.BOOLEAN);
        AstLiteral linefeed = take(environment, elements, ELEMENT_ALLOW_LINEFEED, LiteralKind.BOOLEAN);
        AstLiteral codec = take(environment, elements, ELEMENT_CODEC_NAME, LiteralKind.STRING);
        environment.reportAll(AttributeUtil.reportInvalidElements(attribute, elements.values()));

        Configuration result = new Configuration();
        if (charset != null && checkNotEmpty(environment, ELEMENT_CHARSET_NAME, charset)) {
            result.setCharsetName(charset.toStringValue());
        }
        if (header != null) {
            result.setEnableHeader(header.toBooleanValue());
        }
        if (linefeed != null) {
            result.setAllowLinefeed(linefeed.toBooleanValue());
        }
        if (codec != null && checkNotEmpty(environment, ELEMENT_CODEC_NAME, codec)) {
            result.setCodecName(codec.toStringValue());
        }
        return result;
    }
View Full Code Here

Examples of com.asakusafw.dmdl.model.AstLiteral

                    "@{0}({1}) must be a string literal",
                    TARGET_NAME,
                    elementName));
            return null;
        } else {
            AstLiteral literal = (AstLiteral) element.value;
            if (literal.kind != kind) {
                environment.report(new Diagnostic(
                        Level.ERROR,
                        element,
                        "@{0}({1}) must be a string literal",
View Full Code Here

Examples of com.asakusafw.dmdl.model.AstLiteral

    private Configuration analyzeConfig(
            DmdlSemantics environment,
            AstAttribute attribute,
            Map<String, AstAttributeElement> elements) {
        AstLiteral charset = take(environment, elements, ELEMENT_CHARSET_NAME, LiteralKind.STRING);
        AstLiteral header = take(environment, elements, ELEMENT_HAS_HEADER_NAME, LiteralKind.BOOLEAN);
        AstLiteral allowlf = take(environment, elements, ELEMENT_ALLOW_LINEFEED, LiteralKind.BOOLEAN);
        AstLiteral trueRep = take(environment, elements, ELEMENT_TRUE_NAME, LiteralKind.STRING);
        AstLiteral falseRep = take(environment, elements, ELEMENT_FALSE_NAME, LiteralKind.STRING);
        AstLiteral dateFormat = take(environment, elements, ELEMENT_DATE_NAME, LiteralKind.STRING);
        AstLiteral dateTimeFormat = take(environment, elements, ELEMENT_DATE_TIME_NAME, LiteralKind.STRING);
        AstLiteral codec = take(environment, elements, ELEMENT_CODEC_NAME, LiteralKind.STRING);
        environment.reportAll(AttributeUtil.reportInvalidElements(attribute, elements.values()));

        Configuration result = new Configuration();
        if (charset != null && checkNotEmpty(environment, ELEMENT_CHARSET_NAME, charset)) {
            result.setCharsetName(charset.toStringValue());
        }
        if (header != null) {
            result.setEnableHeader(header.toBooleanValue());
        }
        if (allowlf != null) {
            result.setAllowLinefeed(allowlf.toBooleanValue());
        }
        if (trueRep != null && checkNotEmpty(environment, ELEMENT_TRUE_NAME, trueRep)) {
            result.setTrueFormat(trueRep.toStringValue());
        }
        if (falseRep != null && checkNotEmpty(environment, ELEMENT_FALSE_NAME, falseRep)) {
            result.setFalseFormat(falseRep.toStringValue());
        }
        if (dateFormat != null && checkDateFormat(environment, ELEMENT_DATE_NAME, dateFormat)) {
            result.setDateFormat(dateFormat.toStringValue());
        }
        if (dateTimeFormat != null && checkDateFormat(environment, ELEMENT_DATE_TIME_NAME, dateTimeFormat)) {
            result.setDateTimeFormat(dateTimeFormat.toStringValue());
        }
        if (codec != null && checkNotEmpty(environment, ELEMENT_CODEC_NAME, codec)) {
            result.setCodecName(codec.toStringValue());
        }
        return result;
    }
View Full Code Here

Examples of com.asakusafw.dmdl.model.AstLiteral

                    TARGET_NAME,
                    elementName,
                    kind));
            return null;
        } else {
            AstLiteral literal = (AstLiteral) element.value;
            if (literal.kind != kind) {
                environment.report(new Diagnostic(
                        Level.ERROR,
                        element,
                        Messages.getString("CsvFormatDriver.diagnosticInvalidLiteralKind"), //$NON-NLS-1$
View Full Code Here

Examples of com.asakusafw.dmdl.model.AstLiteral

    }

    private void consumeTableName(
            DmdlSemantics environment, AstAttribute attribute,
            Map<String, AstAttributeElement> elements, OrcFileTrait result) {
        AstLiteral tableName = take(environment, attribute, elements, ELEMENT_TABLE_NAME, LiteralKind.STRING);
        if (tableName != null) {
            String value = tableName.toStringValue();
            if (AttributeUtil.checkPresent(environment, tableName, label(ELEMENT_TABLE_NAME), value)) {
                result.setTableName(value);
            }
        }
    }
View Full Code Here

Examples of com.asakusafw.dmdl.model.AstLiteral

    }

    private void consumeFormatVersion(
            DmdlSemantics environment, AstAttribute attribute,
            Map<String, AstAttributeElement> elements, OrcFileTrait result) {
        AstLiteral formatVersion = take(environment, attribute, elements, ELEMENT_FORMAT_VERSION, LiteralKind.STRING);
        if (formatVersion != null) {
            String symbol = formatVersion.toStringValue();
            try {
                OrcFile.Version value = OrcFile.Version.byName(symbol);
                result.configuration().withFormatVersion(value);
            } catch (IllegalArgumentException e) {
                environment.report(new Diagnostic(
View Full Code Here

Examples of com.asakusafw.dmdl.model.AstLiteral

    }

    private <T extends Enum<?>> T consumeOption(
            DmdlSemantics environment, AstAttribute attribute, Map<String, AstAttributeElement> elements,
            String key, String description, T[] options) {
        AstLiteral literal = take(environment, attribute, elements, key, LiteralKind.STRING);
        if (literal != null) {
            String symbol = literal.toStringValue();
            T value = find(options, symbol);
            if (value == null) {
                environment.report(new Diagnostic(
                        Level.ERROR,
                        literal,
View Full Code Here

Examples of com.asakusafw.dmdl.model.AstLiteral

    }

    private void consumeStripeSize(
            DmdlSemantics environment, AstAttribute attribute,
            Map<String, AstAttributeElement> elements, OrcFileTrait result) {
        AstLiteral stripeSize = take(environment, attribute, elements, ELEMENT_STRIPE_SIZE, LiteralKind.INTEGER);
        if (stripeSize != null) {
            String label = label(ELEMENT_STRIPE_SIZE);
            BigInteger value = stripeSize.toIntegerValue();
            if (AttributeUtil.checkRange(environment, stripeSize, label, value, MINIMUM_STRIPE_SIZE, Long.MAX_VALUE)) {
                result.configuration().withStripeSize(value.longValue());
            }
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.