List of usage examples for java.lang Boolean valueOf
public static Boolean valueOf(String s)
From source file:com.googlecode.psiprobe.controllers.wrapper.RestartJvmController.java
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { boolean done = false; try {// w w w .j av a 2s. c om Class.forName("org.tanukisoftware.wrapper.WrapperManager"); logger.info("JVM is RESTARTED by " + request.getRemoteAddr()); WrapperManager.restartAndReturn(); done = true; } catch (ClassNotFoundException e) { logger.info("WrapperManager not found. Do you have wrapper.jar in the classpath?"); } return new ModelAndView(getViewName(), "done", Boolean.valueOf(done)); }
From source file:com.googlecode.psiprobe.controllers.wrapper.ThreadDumpController.java
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { boolean done = false; try {/*from w w w.ja va 2s . co m*/ Class.forName("org.tanukisoftware.wrapper.WrapperManager"); logger.info("ThreadDump requested by " + request.getRemoteAddr()); WrapperManager.requestThreadDump(); done = true; } catch (ClassNotFoundException e) { logger.info("WrapperManager not found. Do you have wrapper.jar in the classpath?"); } return new ModelAndView(getViewName(), "done", Boolean.valueOf(done)); }
From source file:com.wabacus.system.datatype.BooleanType.java
public Object getColumnValue(ResultSet rs, int iindex, AbsDatabaseType dbtype) throws SQLException { return Boolean.valueOf(rs.getBoolean(iindex)); }
From source file:com.qualogy.qafe.business.integration.filter.page.PageCreator.java
/** * Method to create a page object based page data in the datastore. * If no data supplied for the page, null is returned * @param id/*from w w w. ja v a 2 s .co m*/ * @return */ public static Page create(DataIdentifier id) { Page page = null; Object objPageNr = DataStore.findValue(id, DataStore.KEY_WORD_PAGE_NUMBER); Object objPageSize = DataStore.findValue(id, DataStore.KEY_WORD_PAGESIZE); if (objPageSize != null) { int pagesize = 0; if (objPageSize instanceof Number) pagesize = ((Number) objPageSize).intValue(); else if (objPageSize instanceof String && NumberUtils.isNumber((String) objPageSize)) pagesize = Integer.parseInt((String) objPageSize); if (pagesize > -1) { int pagenumber = 0; if (objPageNr instanceof Number) pagenumber = ((Number) objPageNr).intValue(); else if (objPageNr instanceof String && NumberUtils.isNumber((String) objPageNr)) pagenumber = Integer.parseInt((String) objPageNr); else if (objPageNr instanceof String && ((String) objPageNr).toUpperCase().equals(DataStore.KEY_WORD_PAGE_NUMBER_LAST)) pagenumber = Integer.MAX_VALUE; boolean countPages = false; Object objCountPages = DataStore.findValue(id, DataStore.KEY_WORD_CALCULATEPAGESAVAILABLE); if (objCountPages instanceof String) countPages = Boolean.valueOf((String) objCountPages).booleanValue(); else if (objCountPages instanceof Boolean) countPages = ((Boolean) objCountPages).booleanValue(); page = Page.create(pagenumber, pagesize, countPages, id); } } return page; }
From source file:com.glaf.jbpm.util.CustomFieldInstantiator.java
public static Object getValue(Class<?> type, Element propertyElement) { Object value = null;//from w w w .jav a 2 s .c o m if (type == String.class) { value = propertyElement.getText(); } else if ((type == Integer.class) || (type == int.class)) { value = Integer.parseInt(propertyElement.getTextTrim()); } else if ((type == Long.class) || (type == long.class)) { value = Long.parseLong(propertyElement.getTextTrim()); } else if ((type == Float.class) || (type == float.class)) { value = new Float(propertyElement.getTextTrim()); } else if ((type == Double.class) || (type == double.class)) { value = Double.parseDouble(propertyElement.getTextTrim()); } else if ((type == Boolean.class) || (type == boolean.class)) { value = Boolean.valueOf(propertyElement.getTextTrim()); } else if ((type == Character.class) || (type == char.class)) { value = Character.valueOf(propertyElement.getTextTrim().charAt(0)); } else if ((type == Short.class) || (type == short.class)) { value = Short.valueOf(propertyElement.getTextTrim()); } else if ((type == Byte.class) || (type == byte.class)) { value = Byte.valueOf(propertyElement.getTextTrim()); } else if (type.isAssignableFrom(java.util.Date.class)) { value = DateUtils.toDate(propertyElement.getTextTrim()); } else if (type.isAssignableFrom(List.class)) { value = getCollectionValue(propertyElement, new java.util.ArrayList<Object>()); } else if (type.isAssignableFrom(Set.class)) { value = getCollectionValue(propertyElement, new LinkedHashSet<Object>()); } else if (type.isAssignableFrom(Collection.class)) { value = getCollectionValue(propertyElement, new java.util.ArrayList<Object>()); } else if (type.isAssignableFrom(Map.class)) { value = getMapValue(propertyElement, new LinkedHashMap<Object, Object>()); } else if (type == Element.class) { value = propertyElement; } else { try { Constructor<?> constructor = type.getConstructor(new Class[] { String.class }); if ((propertyElement.isTextOnly()) && (constructor != null)) { value = constructor.newInstance(new Object[] { propertyElement.getTextTrim() }); } } catch (Exception ex) { logger.error("couldn't parse the bean property value '" + propertyElement.asXML() + "' to a '" + type.getName() + "'"); throw new RuntimeException(ex); } } return value; }
From source file:com.glaf.core.config.SystemProperties.java
public static boolean getBoolean(String key, boolean defaultValue) { if (hasObject(key)) { String value = conf.get(key); return Boolean.valueOf(value).booleanValue(); }//from w w w. j a v a 2s .c o m return defaultValue; }
From source file:org.activiti.rest.util.MultipartRequestObject.java
public Boolean getBoolean(String param) { return Boolean.valueOf(this.request.getParameter(param)); }
From source file:net.sf.ehcache.loader.ComponentALoader.java
/** * /*ww w . j a v a2 s. c o m*/ * @param arg0 * @return * @throws CacheException */ public Object load(Object arg0) throws CacheException { String key = null; ComponentA a = null; ComponentB b = null; boolean createDeadLock = Boolean.valueOf(props.getProperty("createDeadLock")).booleanValue(); LOG.info("createDeadLock=" + createDeadLock); if (createDeadLock) { key = (String) arg0; } else { key = new String((String) arg0); } LOG.info("Getting componentB..."); b = (ComponentB) CacheHelper.get("ehcache-loaderinteractions.xml", "BCache", key); return new ComponentA(key, b); }
From source file:fr.aliasource.webmail.server.proxy.client.http.GetQuotaMethod.java
public QuotaInfo getQuota(String mailBox) { Map<String, String> params = new HashMap<String, String>(); params.put("token", token); params.put("mailBox", mailBox); Document doc = execute(params); if (doc != null) { if (logger.isDebugEnabled()) { DOMUtils.logDom(doc);//from ww w .j a v a 2 s . co m } Element root = doc.getDocumentElement(); boolean enable = Boolean.valueOf(DOMUtils.getElementText(root, "enable")); int usage = Integer.parseInt(DOMUtils.getElementText(root, "usage")); int limit = Integer.parseInt(DOMUtils.getElementText(root, "limit")); return new QuotaInfo(enable, usage, limit); } return new QuotaInfo(); }
From source file:com.google.walkaround.util.server.flags.JsonFlags.java
@VisibleForTesting @SuppressWarnings("unchecked") static Object parseOneFlag(FlagDeclaration decl, JSONObject json) throws FlagFormatException { String key = decl.getName();// w ww .ja v a 2 s . c o m Class<?> type = decl.getType(); try { if (!json.has(key)) { throw new FlagFormatException("Missing flag: " + key); } // Explicit check, otherwise null would be interpreted as "null" (the // string) for string and enum values. if (json.isNull(key)) { throw new FlagFormatException("Null value for key " + key); } if (type == String.class) { return json.getString(key); } else if (type == Boolean.class) { return Boolean.valueOf(json.getBoolean(key)); } else if (type == Integer.class) { int val = json.getInt(key); if (val != json.getDouble(key)) { throw new FlagFormatException( "Loss of precision for type int, key=" + key + ", value=" + json.getDouble(key)); } return Integer.valueOf(val); } else if (type == Double.class) { return Double.valueOf(json.getDouble(key)); } else if (type.isEnum()) { // TODO(ohler): Avoid unchecked warning here, the rest of the method should be clean. return parseEnumValue(type.asSubclass(Enum.class), key, json.getString(key).toUpperCase()); } else { throw new IllegalArgumentException("Unknown flag type " + type.getName()); } } catch (JSONException e) { throw new FlagFormatException( "Invalid flag JSON for key " + key + " (possibly a bad type); map=" + json, e); } }