Switched to getValueOrAttribute()

This commit is contained in:
Erik C. Thauvin 2023-03-17 06:53:21 -07:00
parent 625c211b62
commit 4460e98f67
19 changed files with 18 additions and 38 deletions

View file

@ -17,8 +17,6 @@
package rife.render;
import rife.template.Template;
import rife.tools.Convert;
import rife.tools.Localization;
import rife.tools.StringUtils;
@ -78,24 +76,6 @@ public final class RenderUtils {
return sb.toString();
}
/**
* Fetches the specified value from a template or template's attribute.
*
* @param template the template
* @param valueId the ID of the value to fetch
* @return the fetched value.
*/
public static String fetchValue(Template template, String valueId) {
Object value = null;
if (template.hasValueId(valueId)) {
value = template.getValue(valueId);
}
if (value == null && template.hasAttribute(valueId)) {
value = template.getAttribute(valueId);
}
return Convert.toString(value);
}
/**
* Returns the last 4 digits a credit card number. The number must satisfy the Luhn algorithm.
* Non-digits are stripped from the number.