class FormFunction {

   @FunctionMeta(description = "Show radio from an object's properties in a form", example = "${w:showRadio('groupBy', groupBy, payload.groupBy, 'name', 'description')}")
   public static String showRadio(String inputName, Object item, Object selected, String valueName, String textName) {
      StringBuilder sb = new StringBuilder(256);
      Object value = getPropertyValue(item, valueName);
      Object text = getPropertyValue(item, textName);
      String id = inputName + '-' + value;

      sb.append("<input type=\"radio\" name=\"").append(inputName).append("\" value=\"").append(value).append("\" id=\"")
            .append(id).append("\"");
      sb.append(getSelectedOrChecked(selected, value, false));
      sb.append("><label for=\"").append(id).append("\">").append(text).append("</label>");

      return sb.toString();
   }

}