code: public static Datamappingtype findDataMapping(Object data, String id, Datamappingstype dataMappingConfig) {
        if (null != data) {
           Class clazz = (Class) ((data instanceof Class) ? data : data.getClass());
           for (Datamappingtype dt : dataMappingConfig.getDatamapping()) {
              if (dt.isRegex() && Pattern.compile(dt.getClassname()).matcher(clazz.getName()).find() && idOK(id, dt.getId())) {
                 if (logger.isLoggable(Level.FINE)) {
                    logger.fine(String.format("Datamapping found: %s matches regex %s (requested id: %s)", clazz.getName(), dt.getClassname(), id));
                 }
                 return dt;
              } else if (clazz.getName().equals(dt.getClassname()) && idOK(id, dt.getId())) {
                 if (logger.isLoggable(Level.FINE)) {
                    logger.fine(String.format("Datamapping found: %s matches %s (requested id: %s)", clazz.getName(), dt.getClassname(), id));
                 }
                 return dt;
              }
              if (logger.isLoggable(Level.FINE)) {
                 logger.fine(String.format("%s does not match %s (regex: %s, requested id %s)", dt.getClassname(), clazz.getName(), dt.isRegex(), id));
              }
           }
        }
        return null;
     }
docs: returns the first Datamapping found for an object or Class. A datamapping is valid for an object when either a
  regex is found in the classname of the object or the classname of the object equals the configured classname, when
  an id is provided the id in the datamapping found must match this id, when an id is not provided an id a
  datamapping with an id is not valid.
  
  @param data the object or class for which a data mapping is searched
  @param id an optional id that must be matched by the datamapping
  @param dataMappingConfig
  @return