예제 #1
0
  private void fillEReference(EObject eObject, JsonNode root, Resource resource) {
    final EClass eClass = eObject.eClass();

    for (Iterator<Entry<String, JsonNode>> it = root.getFields(); it.hasNext(); ) {
      Entry<String, JsonNode> field = it.next();

      String key = field.getKey();
      JsonNode value = field.getValue();

      EReference reference = getEReference(eClass, key);
      if (reference != null
          && !reference.isContainment()
          && !reference.isDerived()
          && !reference.isTransient()) {

        if (value.isArray()) {
          for (Iterator<JsonNode> itEl = value.getElements(); itEl.hasNext(); ) {
            JsonNode current = itEl.next();
            createProxyReference(eObject, root, current, reference, resource);
          }
        } else {
          createProxyReference(eObject, root, value, reference, resource);
        }
      }
    }

    for (EObject content : eObject.eContents()) {
      if (processed.containsKey(content)) fillEReference(content, processed.get(content), resource);
    }
  }
예제 #2
0
 protected void clearReference(EObject obj, EReference ref) {
   if (!ref.isContainment()
       && !ref.isContainer()
       && !ref.isDerived()
       && ref.isChangeable()
       && !ref.isTransient()) obj.eUnset(ref);
 }
예제 #3
0
 @Override
 public Object caseEReference(EReference object) {
   Attribute attrib = new Attribute(object.getName());
   attrib.type = getType(object.getEType());
   attrib.setBounds(object.getLowerBound(), object.getUpperBound());
   attrib.setStatic(false);
   attrib.setScope(Scope.PUBLIC);
   attrib.setContainment(object.isContainment());
   attrib.setDerived(object.isDerived());
   return attrib;
 }