{
    EStructuralFeature result = null;
    if (isFeatureKindSpecific())
    {
      List<EStructuralFeature> allAttributes = getAllAttributes(eClass);
      for (int i = 0, size = allAttributes.size(); i < size; ++i)
      {
        EStructuralFeature eStructuralFeature = allAttributes.get(i);
        if (name.equals(getName(eStructuralFeature)))
        {
          String featureNamespace = getNamespace(eStructuralFeature);
          if (namespace == null) 
          {
            if (featureNamespace == null)
            {
              return eStructuralFeature;
            }
            else if (result == null)
            {
              result = eStructuralFeature;
            }
          }
          else if (namespace.equals(featureNamespace))
          {
            return eStructuralFeature;
          }
          else if (featureNamespace == null && result == null)
          {
            result = eStructuralFeature;
          }
        }
      }
    }
    else
    {
      for (int i = 0, size = eClass.getFeatureCount(); i < size; ++i)
      {
        EStructuralFeature eStructuralFeature = eClass.getEStructuralFeature(i);
        switch (getFeatureKind(eStructuralFeature))
        {
          case UNSPECIFIED_FEATURE:
          case ATTRIBUTE_FEATURE:
          {
            if (name.equals(getName(eStructuralFeature)))
            {
              String featureNamespace = getNamespace(eStructuralFeature);
              if (namespace == null) 
              {
                if (featureNamespace == null)
                {
                  return eStructuralFeature;
                }
                else if (result == null)
                {
                  result = eStructuralFeature;
                }
              }
              else if (namespace.equals(featureNamespace))
              {
                return eStructuralFeature;
              }
              else if (featureNamespace == null && result == null)
              {
                result = eStructuralFeature;
              }
            }
            break;
          }
        }
      }
    }

    return isFeatureNamespaceMatchingLax() ? result : null;
  }