Package my.home.dsl.deepClone

Examples of my.home.dsl.deepClone.ContainerType


   * Every member field must be defined once in its parent container
   * @param fieldCloner
   */
  @Check
  public void checkFieldUniquity(FieldClonerType fieldCloner) {
    ContainerType parentContainer = ((ContainerType)fieldCloner.eContainer());
    List<FieldClonerType> declaredfields = parentContainer.getFields();
    int uniquityCounter = 0;
    for (FieldClonerType otherField : declaredfields) {
      if (otherField.getFieldName().equals(fieldCloner.getFieldName())) uniquityCounter++;
      if (uniquityCounter>1) {
        error("Field " + fieldCloner.getFieldName() + " is declared more then once in container " + dcUtils.getNodeQualifiedName(parentContainer),
View Full Code Here


      _builder.newLine();
      final String sample = _builder.toString();
      final Model model = this.parser.parse(sample);
      EList<ClassCloner> _cloners = ((Body) model).getCloners();
      ClassCloner _get = _cloners.get(0);
      final ContainerType cloner = this._deepCloneUtils.asContainer(_get);
      ArrayList<String> _newArrayList = CollectionLiterals.<String>newArrayList("paragraph");
      this._deepCloneUtils.addFields(cloner, _newArrayList);
      final String result = this._iSerializer.serialize(model);
      StringConcatenation _builder_1 = new StringConcatenation();
      _builder_1.append("deepClone");
View Full Code Here

      _builder.newLine();
      final String sample = _builder.toString();
      final Model model = this.parser.parse(sample);
      EList<ClassCloner> _cloners = ((Body) model).getCloners();
      ClassCloner _get = _cloners.get(0);
      final ContainerType cloner = this._deepCloneUtils.asContainer(_get);
      ArrayList<String> _newArrayList = CollectionLiterals.<String>newArrayList("paragraph");
      this._deepCloneUtils.addFields(cloner, _newArrayList);
      SaveOptions.Builder _newBuilder = SaveOptions.newBuilder();
      SaveOptions.Builder _format = _newBuilder.format();
      SaveOptions _options = _format.getOptions();
View Full Code Here

      _builder_1.append("[author, name]");
      final String expectedMissingFieldNamesForBookCloner = _builder_1.toString();
      final Model model = this.parser.parse(sample);
      EList<ClassCloner> _cloners = ((Body) model).getCloners();
      ClassCloner _get = _cloners.get(0);
      final ContainerType cloner = this._deepCloneUtils.asContainer(_get);
      final Set<String> missingFieldNamesSet = this._deepCloneUtils.findMissingFieldsInContainerElement(cloner);
      String _string = expectedMissingFieldNamesForBookCloner.toString();
      List<String> _sort = IterableExtensions.<String>sort(missingFieldNamesSet);
      Object[] _array = _sort.toArray();
      String _string_1 = ((List<Object>)Conversions.doWrapArray(_array)).toString();
View Full Code Here

      _builder_1.append("[section]");
      final String expectedMissingFieldNamesForBookCloner = _builder_1.toString();
      final Model model = this.parser.parse(sample);
      EList<ClassCloner> _cloners = ((Body) model).getCloners();
      ClassCloner _get = _cloners.get(0);
      final ContainerType cloner = this._deepCloneUtils.asContainer(_get);
      final Set<String> missingFieldNamesSet = this._deepCloneUtils.findMissingFieldsInContainerElement(cloner);
      String _string = expectedMissingFieldNamesForBookCloner.toString();
      List<String> _sort = IterableExtensions.<String>sort(missingFieldNamesSet);
      Object[] _array = _sort.toArray();
      String _string_1 = ((List<Object>)Conversions.doWrapArray(_array)).toString();
View Full Code Here

      _builder_1.append("[description, name, paragraph]");
      final String expectedMissingFieldNamesForSectionElement = _builder_1.toString();
      final Model model = this.parser.parse(sample);
      EList<ClassCloner> _cloners = ((Body) model).getCloners();
      ClassCloner _get = _cloners.get(0);
      final ContainerType cloner = this._deepCloneUtils.asContainer(_get);
      EList<FieldClonerType> _fields = cloner.getFields();
      final Function1<FieldClonerType,Boolean> _function = new Function1<FieldClonerType,Boolean>() {
        public Boolean apply(final FieldClonerType it) {
          String _fieldName = it.getFieldName();
          boolean _equals = Objects.equal(_fieldName, "section");
          return Boolean.valueOf(_equals);
        }
      };
      FieldClonerType _findFirst = IterableExtensions.<FieldClonerType>findFirst(_fields, _function);
      final ContainerType section = this._deepCloneUtils.asContainer(_findFirst);
      final Set<String> missingFieldNamesInSection = this._deepCloneUtils.findMissingFieldsInContainerElement(section);
      String _string = expectedMissingFieldNamesForSectionElement.toString();
      List<String> _sort = IterableExtensions.<String>sort(missingFieldNamesInSection);
      Object[] _array = _sort.toArray();
      String _string_1 = ((List<Object>)Conversions.doWrapArray(_array)).toString();
View Full Code Here

      _builder_1.append("[]");
      final String expectedMissingFieldNamesForFooFooElement = _builder_1.toString();
      final Model model = this.parser.parse(sample);
      EList<ClassCloner> _cloners = ((Body) model).getCloners();
      ClassCloner _get = _cloners.get(0);
      final ContainerType cloner = this._deepCloneUtils.asContainer(_get);
      EList<FieldClonerType> _fields = cloner.getFields();
      final Function1<FieldClonerType,Boolean> _function = new Function1<FieldClonerType,Boolean>() {
        public Boolean apply(final FieldClonerType it) {
          String _fieldName = it.getFieldName();
          boolean _equals = Objects.equal(_fieldName, "fooFoo");
          return Boolean.valueOf(_equals);
        }
      };
      FieldClonerType _findFirst = IterableExtensions.<FieldClonerType>findFirst(_fields, _function);
      final ContainerType fooFoo = this._deepCloneUtils.asContainer(_findFirst);
      final Set<String> missingFieldNamesInSection = this._deepCloneUtils.findMissingFieldsInContainerElement(fooFoo);
      String _string = expectedMissingFieldNamesForFooFooElement.toString();
      List<String> _sort = IterableExtensions.<String>sort(missingFieldNamesInSection);
      Object[] _array = _sort.toArray();
      String _string_1 = ((List<Object>)Conversions.doWrapArray(_array)).toString();
View Full Code Here

        "Add all missing fields", // label text
        "Add all missing fields", // description text
        null, // quick fix icon
        new ISemanticModification() {
          public void apply(EObject element, IModificationContext context) {
            ContainerType parentContainer = (ContainerType)element;
            List<String> fieldsToBeAdded = Arrays.asList(issue.getData());
            deepCloneUtils.addFields(parentContainer, fieldsToBeAdded);
          }
        }
      );
View Full Code Here

        "Remove all surplus fields", // label text
        "Remove all surplus fields", // description text
        null, // quick fix icon
        new ISemanticModification() {
          public void apply(EObject element, IModificationContext context) {
            ContainerType parentContainer = (ContainerType)element.eContainer();
            List<String> fieldsToBeRemoved = Arrays.asList(issue.getData());
            deepCloneUtils.removeFields(parentContainer, fieldsToBeRemoved);
          }
        }
      );
View Full Code Here

      _builder_1.append("}");
      final String expectedModifiedSample = _builder_1.toString();
      final Model model = this.parser.parse(sample);
      EList<ClassCloner> _cloners = ((Body) model).getCloners();
      ClassCloner _get = _cloners.get(0);
      final ContainerType cloner = this._deepCloneUtils.asContainer(_get);
      ArrayList<String> _newArrayList = CollectionLiterals.<String>newArrayList("fooFoo");
      this._deepCloneUtils.removeFields(cloner, _newArrayList);
      final String result = this._iSerializer.serialize(model);
      Assert.assertEquals(expectedModifiedSample, result);
    } catch (Throwable _e) {
View Full Code Here

TOP

Related Classes of my.home.dsl.deepClone.ContainerType

Copyright © 2018 www.massapicom. 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.