Search in sources :

Example 1 with Attribute

use of com.avaloq.tools.ddk.xtext.export.export.Attribute in project dsl-devkit by dsldevkit.

the class ExportJavaValidator method checkExportFieldUniqueness.

/**
 * Checks that the exports don't have overlapping features, as a feature export is inherited by the export of subtypes.
 *
 * @param context
 *          model to check
 */
@Check
public void checkExportFieldUniqueness(final ExportModel context) {
    UniquenessJavaValidationHelper<Attribute> helper = new UniquenessJavaValidationHelper<Attribute>(NameFunctions.fromFeature(ExportPackage.Literals.ATTRIBUTE__ATTRIBUTE), getMessageAcceptor()) {

        @Override
        public String getMessage(final Attribute attribute) {
            return "duplicate found: " + attribute.getAttribute().getName();
        }
    };
    UniquenessJavaValidationHelper<UserData> helper2 = new UniquenessJavaValidationHelper<UserData>(NameFunctions.fromFeature(ExportPackage.Literals.USER_DATA__NAME), getMessageAcceptor());
    for (Export export : context.getExports()) {
        helper.errorOnDuplicates(export.getAttributes(), ExportPackage.Literals.ATTRIBUTE__ATTRIBUTE);
        helper2.errorOnDuplicates(export.getUserData(), ExportPackage.Literals.USER_DATA__NAME);
    }
}
Also used : Attribute(com.avaloq.tools.ddk.xtext.export.export.Attribute) UserData(com.avaloq.tools.ddk.xtext.export.export.UserData) Export(com.avaloq.tools.ddk.xtext.export.export.Export) UniquenessJavaValidationHelper(com.avaloq.tools.ddk.xtext.validation.UniquenessJavaValidationHelper) Check(org.eclipse.xtext.validation.Check)

Aggregations

Attribute (com.avaloq.tools.ddk.xtext.export.export.Attribute)1 Export (com.avaloq.tools.ddk.xtext.export.export.Export)1 UserData (com.avaloq.tools.ddk.xtext.export.export.UserData)1 UniquenessJavaValidationHelper (com.avaloq.tools.ddk.xtext.validation.UniquenessJavaValidationHelper)1 Check (org.eclipse.xtext.validation.Check)1