public static void setLocale(HttpServletRequest request, String localeString) { UtilHttp.setLocale(request, UtilMisc.parseLocale(localeString)); }
/** Return the text (node value) contained by the named child node. */ public static String childElementValue(Element element, String childElementName) { if (element == null) return null; // get the value of the first element with the given name Element childElement = firstChildElement(element, childElementName); return elementValue(childElement); }
/** isHour returns true if string s is a valid number between 0 and 23. */ public static boolean isHour(String s) { if (isEmpty(s)) return defaultEmptyOK; return isIntegerInRange(s, 0, 23); }
/** * Replaces all occurances of oldString in mainString with newString * @param mainString The original string * @param oldString The string to replace * @param newString The string to insert in place of the old * @return mainString with all occurances of oldString replaced by newString */ public static String replaceString(String mainString, String oldString, String newString) { return StringUtil.replaceString(mainString, oldString, newString); }
/** Returns the number of seconds since the last time timerString was called * @return The number of seconds since the last time timerString was called */ public double secondsSinceLast() { return ((double) timeSinceLast()) / 1000.0; }
public SendMailSMTP(String destinationSMTPServer, String sender, String recipientTO, String message) { setSender(sender); setRecipientTO(recipientTO); setMessage(message); setDestinationSMTPServer(destinationSMTPServer); }
/** * Tests if an object properly implements the specified interface * @param obj Object to test * @param interfaceName Name of the interface to test against */ public static boolean interfaceOf(Object obj, String interfaceName) throws ClassNotFoundException { Class interfaceClass = loadClass(interfaceName); return interfaceOf(obj, interfaceClass); }
/** Formats an int representing a quantity into a string * @param quantity The quantity long to be formatted * @return A String with the formatted quantity */ public static String formatQuantity(long quantity) { return formatQuantity((double) quantity); }
/** * Create a map from passed nameX, valueX parameters * @return The resulting Map */ public static Map toMap(String name1, Object value1, String name2, Object value2) { return new UtilMisc.SimpleMap(name1, value1, name2, value2); /* Map fields = new HashMap(); fields.put(name1, value1); fields.put(name2, value2); return fields;*/ }
public static boolean isOn(int level) { if (useLevelOnCache) { return levelOnCache[level]; } else { return (level == Debug.ALWAYS || UtilProperties.propertyValueEqualsIgnoreCase("debug", levelProps[level], "true")); } }
/** * @see java.util.Map#keySet() */ public Set keySet() { return new OrderedSet(orderedKeys); }
/** * Replaces all occurances of oldString in mainString with newString * @param mainString The original string * @param oldString The string to replace * @param newString The string to insert in place of the old * @return mainString with all occurances of oldString replaced by newString */ public static String replaceString(String mainString, String oldString, String newString) { return StringUtil.replaceString(mainString, oldString, newString); }
/** Formats an int representing a quantity into a string * @param quantity The quantity int to be formatted * @return A String with the formatted quantity */ public static String formatQuantity(int quantity) { return formatQuantity((double) quantity); }
/** * Create a map from passed nameX, valueX parameters * @return The resulting Map */ public static Map toMap(String name1, Object value1) { return new UtilMisc.SimpleMap(name1, value1); /* Map fields = new HashMap(); fields.put(name1, value1); return fields;*/ }
/** Replaces all occurances of oldString in mainString with newString * @param mainString The original string * @param oldString The string to replace * @param newString The string to insert in place of the old * @return mainString with all occurances of oldString replaced by newString */ public static String replaceString(String mainString, String oldString, String newString) { return StringUtil.replaceString(mainString, oldString, newString); }
/** Formats an int representing a quantity into a string * @param quantity The quantity int to be formatted * @return A String with the formatted quantity */ public static String formatQuantity(int quantity) { return formatQuantity((double) quantity); }
/** * Create a map from passed nameX, valueX parameters * @return The resulting Map */ public static Map toMap(String name1, Object value1, String name2, Object value2, String name3, Object value3) { return new UtilMisc.SimpleMap(name1, value1, name2, value2, name3, value3); /* Map fields = new HashMap(); fields.put(name1, value1); fields.put(name2, value2); fields.put(name3, value3); return fields;*/ }