code: public static String replaceFieldTokens(Object obj, String str, List<ReflectedInfo> fields, boolean parentMode)
              throws Siren4JException {
          Map<String, Field> index = new HashMap<String, Field>();
          if (StringUtils.isBlank(str)) {
              return str;
          }
          if (fields != null) {
              for (ReflectedInfo info : fields) {
                  Field f = info.getField();
                  if (f != null) {
                      index.put(f.getName(), f);
                  }
              }
          }
          try {
              for (String key : ReflectionUtils.getTokenKeys(str)) {
                  if ((!parentMode && !key.startsWith("parent.")) || (parentMode && key.startsWith("parent."))) {
                      String fieldname = key.startsWith("parent.") ? key.substring(7) : key;
                      if (index.containsKey(fieldname)) {
                          Field f = index.get(fieldname);
                          if (f.getType().isEnum() || ArrayUtils.contains(propertyTypes, f.getType())) {
                              String replacement = "";
                              Object theObject = f.get(obj);
                              if(f.getType().isEnum()) {
                                  replacement = theObject == null ? "" : ((Enum)theObject).name();
                              } else {
                                  replacement = theObject == null ? "" : theObject.toString();
                              }
                              str = str.replaceAll("\\{" + key + "\\}",
                                  Matcher.quoteReplacement("" + replacement));
                          }
                      }
                  }
              }
          } catch (Exception e) {
              throw new Siren4JException(e);
          }
          return str;
  
      }
docs: Replaces field tokens with the actual value in the fields. The field types must be simple property types
  
  @param str
  @param fields info
  @param parentMode
  @param obj
  @return
  @throws Siren4JException