code: private List<EnhanceEntity> populateEnhanceEntities(EntityMetadata m, List<String> relationNames, List result)
      {
  
          List<EnhanceEntity> ls = null;
          if (!result.isEmpty())
          {
              ls = new ArrayList<EnhanceEntity>(result.size());
              for (Object o : result)
              {
                  EnhanceEntity entity = null;
                  if (!o.getClass().isAssignableFrom(EnhanceEntity.class))
                  {
                      entity = new EnhanceEntity(o, PropertyAccessorHelper.getId(o, m), null);
                  }
                  else
                  {
                      entity = (EnhanceEntity) o;
                  }
                  ls.add(entity);
              }
          }
          return ls;
      }
docs: Populate enhance entities.
  
  @param m
  the m
  @param relationNames
  the relation names
  @param result
  the result
  @return the list