Пример #1
0
 @Check
 public void checkDuplicateFeatureName(final MobaDto payload) {
   Map<String, MobaDtoFeature> _xifexpression = null;
   MobaDto _superType = payload.getSuperType();
   boolean _notEquals = (!Objects.equal(_superType, null));
   if (_notEquals) {
     Map<String, MobaDtoFeature> _xtrycatchfinallyexpression = null;
     try {
       MobaDto _superType_1 = payload.getSuperType();
       List<MobaDtoFeature> _allFeatures = _superType_1.getAllFeatures();
       final Function1<MobaDtoFeature, String> _function =
           (MobaDtoFeature it) -> {
             return it.getName();
           };
       _xtrycatchfinallyexpression =
           IterableExtensions.<String, MobaDtoFeature>toMap(_allFeatures, _function);
     } catch (final Throwable _t) {
       if (_t instanceof RecursionException) {
         final RecursionException ex = (RecursionException) _t;
         _xtrycatchfinallyexpression = Collections.<String, MobaDtoFeature>emptyMap();
       } else {
         throw Exceptions.sneakyThrow(_t);
       }
     }
     _xifexpression = _xtrycatchfinallyexpression;
   } else {
     _xifexpression = Collections.<String, MobaDtoFeature>emptyMap();
   }
   final Map<String, MobaDtoFeature> superFeatureMap = _xifexpression;
   final Set<String> currentFeatures = CollectionLiterals.<String>newHashSet();
   int index = 0;
   EList<MobaDtoFeature> _features = payload.getFeatures();
   for (final MobaDtoFeature feature : _features) {
     {
       String _name = feature.getName();
       boolean _containsKey = superFeatureMap.containsKey(_name);
       if (_containsKey) {
         this.error(
             "Supertype contains same feature name",
             payload,
             MobaPackage.Literals.MOBA_DTO__FEATURES,
             index);
       }
       String _name_1 = feature.getName();
       boolean _contains = currentFeatures.contains(_name_1);
       if (_contains) {
         this.error(
             "Feature name must be unique",
             payload,
             MobaPackage.Literals.MOBA_DTO__FEATURES,
             index);
       }
       String _name_2 = feature.getName();
       currentFeatures.add(_name_2);
       index++;
     }
   }
 }
Пример #2
0
 @Check
 public void checkSuperType(final MobaDto payload) {
   MobaDto _superType = payload.getSuperType();
   boolean _equals = Objects.equal(_superType, null);
   if (_equals) {
     return;
   }
   try {
     payload.getAllSuperTypes();
   } catch (final Throwable _t) {
     if (_t instanceof RecursionException) {
       final RecursionException ex = (RecursionException) _t;
       EObject _source = ex.getSource();
       final MobaDto source = ((MobaDto) _source);
       EObject _superType_1 = ex.getSuperType();
       final MobaDto superType = ((MobaDto) _superType_1);
       StringConcatenation _builder = new StringConcatenation();
       _builder.append("Recursive supertypes for ");
       String _name = source.getName();
       _builder.append(_name, "");
       _builder.append(" --> ");
       String _name_1 = superType.getName();
       _builder.append(_name_1, "");
       this.error(_builder.toString(), payload, MobaPackage.Literals.MOBA_DTO__SUPER_TYPE);
     } else {
       throw Exceptions.sneakyThrow(_t);
     }
   }
 }