use of com.avaloq.tools.ddk.xtext.export.export.DeclarationForType in project dsl-devkit by dsldevkit.
the class ExportJavaValidator method checkInterfaceAndExportUniqueness.
/**
* Checks that the interfaces and exports in an export section all are declared for a unique type.
*
* @param context
* model to check
*/
@Check
public void checkInterfaceAndExportUniqueness(final ExportModel context) {
UniquenessJavaValidationHelper<DeclarationForType> helper = new UniquenessJavaValidationHelper<DeclarationForType>(new AbstractNameFunction() {
@Override
public QualifiedName apply(final EObject from) {
return QualifiedName.create(((DeclarationForType) from).getType().getEPackage().getName(), ((DeclarationForType) from).getType().getName());
}
}, getMessageAcceptor()) {
@Override
public String getMessage(final DeclarationForType declaration) {
return "declaration duplicate found: " + declaration.getType().getEPackage().getName() + "::" + declaration.getType().getName();
}
};
helper.errorOnDuplicates(Iterables.filter(context.getInterfaces(), DeclarationForType.class), ExportPackage.Literals.DECLARATION_FOR_TYPE__TYPE);
helper.errorOnDuplicates(Iterables.filter(context.getExports(), DeclarationForType.class), ExportPackage.Literals.DECLARATION_FOR_TYPE__TYPE);
}
Aggregations