Ejemplo n.º 1
0
  /**
   * Converts the value of an EAttribute with isMany==false, the value is converted ( {@link
   * #convertEAttributeValue(Object, EDataType)}) and set in the correct feature in the eObject.
   *
   * @param modelObject the modelObject from which the value is retrieved.
   * @param eObject the eObject in which the value is set (after it has been converted)
   * @param eAttribute the EAttribute which is converted
   * @see #convertEAttributeValue(Object, EDataType)
   */
  protected void convertSingleEAttribute(
      final ModelObject<?> modelObject, final EObject eObject, final EAttribute eAttribute) {
    final Object value = modelObject.eGet(eAttribute);

    // don't set the eObject if the value is null and the attribute is unsettable.
    // unsettable is modelled with null in Texo.
    if (value == null && ModelUtils.isUnsettable(eAttribute)) {
      eObject.eUnset(eAttribute);
      return;
    }
    final Object newValue = convertEAttributeValue(value, eAttribute.getEAttributeType());
    ((InternalEObject) eObject).eSet(eAttribute, newValue);
  }