Examples of Diagnostic


Examples of com.asakusafw.dmdl.Diagnostic

        assert attribute != null;
        Map<String, AstAttributeElement> elements = AttributeUtil.getElementMap(attribute);
        AstAttributeElement target = elements.remove(ELEMENT_NAME);
        environment.reportAll(AttributeUtil.reportInvalidElements(attribute, elements.values()));
        if (target == null) {
            environment.report(new Diagnostic(
                    Level.ERROR,
                    attribute.name,
                    "@{0} must declare an element \"{1}=...\"",
                    TARGET_NAME,
                    ELEMENT_NAME));
            return null;
        } else if ((target.value instanceof AstLiteral) == false) {
            environment.report(new Diagnostic(
                    Level.ERROR,
                    target,
                    "@{0}.{1} must be a string literal",
                    TARGET_NAME,
                    ELEMENT_NAME));
            return null;
        } else {
            AstLiteral literal = (AstLiteral) target.value;
            if (literal.kind != LiteralKind.STRING) {
                environment.report(new Diagnostic(
                        Level.ERROR,
                        target,
                        "@{0}.{1} must be a string literal",
                        TARGET_NAME,
                        ELEMENT_NAME));
View Full Code Here

Examples of com.asakusafw.dmdl.Diagnostic

                scaleValue = scale.toIntegerValue().intValue();
            }
        }
        if (precisionValue >= 0 && scaleValue >= 0) {
            if (precisionValue < scaleValue) {
                environment.report(new Diagnostic(
                        Level.ERROR,
                        attribute,
                        Messages.getString("HiveDecimalDriver.diagnosticPrecisionLessThanScale"), //$NON-NLS-1$
                        TARGET_NAME,
                        ELEMENT_PRECISION_NAME, precisionValue,
View Full Code Here

Examples of com.asakusafw.dmdl.Diagnostic

            }
            Class<?> valueClass = EmitContext.getFieldTypeAsClass(property);
            TypeInfo typeInfo = HiveFieldTrait.getTypeInfo(property);
            ParquetValueDriver driver = ParquetValueDrivers.find(typeInfo, valueClass);
            if (driver == null) {
                environment.report(new Diagnostic(Diagnostic.Level.ERROR,
                        property.getOriginalAst(),
                        Messages.getString("ParquetFileDriver.diagnosticUnsupportedPropertyType"), //$NON-NLS-1$
                        typeInfo.getQualifiedName(),
                        property.getName().identifier,
                        property.getType()));
View Full Code Here

Examples of com.asakusafw.dmdl.Diagnostic

            String symbol = formatVersion.toStringValue();
            try {
                ParquetProperties.WriterVersion value = ParquetProperties.WriterVersion.fromString(symbol);
                result.configuration().withWriterVersion(value);
            } catch (IllegalArgumentException e) {
                environment.report(new Diagnostic(
                        Level.ERROR,
                        formatVersion,
                        Messages.getString("ParquetFileDriver.diagnosticUnknownElement"), //$NON-NLS-1$
                        TARGET_NAME,
                        ELEMENT_FORMAT_VERSION,
View Full Code Here

Examples of com.asakusafw.dmdl.Diagnostic

        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,
                        Messages.getString("ParquetFileDriver.diagnosticUnknownElement"), //$NON-NLS-1$
                        TARGET_NAME,
                        key,
View Full Code Here

Examples of com.asakusafw.dmdl.Diagnostic

        assert attribute != null;
        Map<String, AstAttributeElement> elements = AttributeUtil.getElementMap(attribute);
        AstAttributeElement nameElement = elements.remove(ELEMENT_NAME);
        environment.reportAll(AttributeUtil.reportInvalidElements(attribute, elements.values()));
        if (nameElement == null) {
            environment.report(new Diagnostic(
                    Level.ERROR,
                    attribute.name,
                    "@{0} must declare the element \"{1}=...\"",
                    TARGET_NAME,
                    ELEMENT_NAME));
            return Collections.emptyList();
        } else if ((nameElement.value instanceof AstAttributeValueArray) == false) {
            environment.report(new Diagnostic(
                    Level.ERROR,
                    nameElement,
                    "@{0}.{1} must be an array of name",
                    TARGET_NAME,
                    ELEMENT_NAME));
            return Collections.emptyList();
        }
        AstAttributeValueArray array = (AstAttributeValueArray) nameElement.value;
        List<PropertySymbol> properties = Lists.create();
        for (AstAttributeValue value : array.elements) {
            if ((value instanceof AstSimpleName) == false) {
                environment.report(new Diagnostic(
                        Level.ERROR,
                        value,
                        "{0}.{1} must be a simple property name of array",
                        TARGET_NAME,
                        ELEMENT_NAME));
                continue;
            }
            PropertySymbol property = declaration.createPropertySymbol((AstSimpleName) value);
            if (property.findDeclaration() == null) {
                environment.report(new Diagnostic(
                        Level.ERROR,
                        value,
                        "{0} is not declared in {1}",
                        value,
                        declaration.getName()));
View Full Code Here

Examples of com.asakusafw.dmdl.Diagnostic

        assert attribute != null;
        Map<String, AstAttributeElement> elements = AttributeUtil.getElementMap(attribute);
        AstAttributeElement target = elements.remove(ELEMENT_NAME);
        environment.reportAll(AttributeUtil.reportInvalidElements(attribute, elements.values()));
        if (target == null) {
            environment.report(new Diagnostic(
                    Level.ERROR,
                    attribute.name,
                    "@{0} must declare an element \"{1}=...\"",
                    TARGET_NAME,
                    ELEMENT_NAME));
            return null;
        } else if ((target.value instanceof AstLiteral) == false) {
            environment.report(new Diagnostic(
                    Level.ERROR,
                    target,
                    "@{0}.{1} must be a string literal",
                    TARGET_NAME,
                    ELEMENT_NAME));
            return null;
        } else {
            AstLiteral literal = (AstLiteral) target.value;
            if (literal.kind != LiteralKind.STRING) {
                environment.report(new Diagnostic(
                        Level.ERROR,
                        target,
                        "@{0}.{1} must be a string literal",
                        TARGET_NAME,
                        ELEMENT_NAME));
View Full Code Here

Examples of com.asakusafw.dmdl.Diagnostic

    public void process(
            DmdlSemantics environment,
            ModelDeclaration declaration,
            AstAttribute attribute) {
        if (declaration.getOriginalAst().kind != ModelDefinitionKind.RECORD) {
            environment.report(new Diagnostic(
                    Level.ERROR,
                    declaration.getOriginalAst(),
                    "@{0} is only for record model",
                    TARGET_NAME));
            return;
View Full Code Here

Examples of com.asakusafw.dmdl.Diagnostic

            }
            return (AstLiteral) nameElement.value;
        }

        void error(AstNode elemenet, String format, Object... arguments) {
            environment.report(new Diagnostic(Level.ERROR, attribute, format, arguments));
            sawError = true;
        }
View Full Code Here

Examples of com.asakusafw.dmdl.Diagnostic

        if (elements.isEmpty()) {
            return Collections.emptyList();
        }
        List<Diagnostic> results = Lists.create();
        for (AstAttributeElement element : elements) {
            results.add(new Diagnostic(
                    Level.ERROR,
                    element.name,
                    Messages.getString("AttributeUtil.diagnosticUnknownElement"), //$NON-NLS-1$
                    attribute.name,
                    element.name));
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.