/** * Sets a new value for the given property name. * * @param name The name of the property whose value is to be set. * @param value The value of the property being set. */ public static void setValue(String name, String value) { // it is invalid to set a property value null, so convert to empty string if (value == null) { value = ""; // NOPMD } props.setProperty(name, value); }
private void translate(HttpServletRequest request, ModelAndView next, WikiPageInfo pageInfo) throws Exception { pageInfo.setContentJsp(JSP_ADMIN_TRANSLATION); pageInfo.setAdmin(true); pageInfo.setPageTitle(new WikiMessage("translation.title")); Enumeration names = request.getParameterNames(); String name; SortedProperties translations = new SortedProperties(); while (names.hasMoreElements()) { name = (String) names.nextElement(); if (!name.startsWith("translations[") || !name.endsWith("]")) { continue; } String key = name.substring("translations[".length(), name.length() - "]".length()); String value = request.getParameter(name); translations.setProperty(key, value); } Environment.saveProperties(filename(request), translations, null); this.writeTopic(request, null); next.addObject("translations", new TreeMap(translations)); next.addObject("codes", this.retrieveTranslationCodes()); }
/** * Sets a new integer value for the given property name. * * @param name The name of the property whose value is to be set. * @param value The value of the property being set. */ public static void setIntValue(String name, int value) { props.setProperty(name, Integer.toString(value)); }
/** * Set a new boolean value for the given property name. * * @param name The name of the property whose value is to be set. * @param value The value of the property being set. */ public static void setBooleanValue(String name, boolean value) { props.setProperty(name, Boolean.toString(value)); }