capint
11/24/2015 - 12:54 PM

EMF >> Resource >> XMLHelper

EMF >> Resource >> XMLHelper

//*** Create an object given an EFactory and a type   
  public EObject createObject(EFactory eFactory, EClassifier type)
  {
    EObject newObject = null;
    if (eFactory != null)
    {
      if (extendedMetaData != null)
      {
        if (type == null)
        {
          return null;
        }
        else if (type instanceof EClass)
        {
          EClass eClass = (EClass)type;
          if (!eClass.isAbstract())
          {
            newObject = eFactory.create((EClass)type);
          }
        }
        else
        {
          SimpleAnyType result = (SimpleAnyType)EcoreUtil.create(anySimpleType);
          result.setInstanceType((EDataType)type);
          newObject = result;
        }
      }
      else
      {
        if (type != null)
        {
          EClass eClass = (EClass)type;
          if (!eClass.isAbstract())
          {
            newObject = eFactory.create((EClass)type);
          }
        }
      }
    }
    return newObject;
  }