Mercurial Hosting > nabble
view src/nabble/view/web/template/NamespaceUtils.java @ 19:18cf4872fd7f
remove anonymous posting
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Fri, 29 May 2020 22:58:25 -0600 |
parents | 7ecd1a4ef557 |
children |
line wrap: on
line source
package nabble.view.web.template; import nabble.naml.compiler.Interpreter; import nabble.model.Site; public class NamespaceUtils { public static int getInt(Interpreter interp, String attributeName, String errorMessage) { return getInt(interp, attributeName, null, errorMessage); } public static int getInt(Interpreter interp, String attributeName, Integer defaultValue, String errorMessage) { String value = interp.getArgString(attributeName); if (value == null && defaultValue != null) return defaultValue; try { return Integer.valueOf(value.trim()); } catch(NumberFormatException e) { throw new RuntimeException(errorMessage,e); } } }