List of usage examples for org.apache.commons.lang StringUtils isEmpty
public static boolean isEmpty(String str)
Checks if a String is empty ("") or null.
From source file:com.laex.cg2d.model.model.ResourceFile.java
/** * Checks if is empty.//from ww w . j a v a 2 s. co m * * @param resFile the res file * @return true, if is empty */ public static boolean isEmpty(CGResourceFile resFile) { return StringUtils.isEmpty(resFile.getResourceFile()); }
From source file:it.biztech.btable.util.Utils.java
public static IBasicFile getFile(String filePath, String basePath) { if (StringUtils.isEmpty(filePath)) { return null; }/*from www . j av a 2 s. com*/ IContentAccessFactory factory = PentahoPluginEnvironment.getInstance().getContentAccessFactory(); String res = StringUtils.strip(filePath.toLowerCase(), "/"); if (res.startsWith(BTableConstants.SYSTEM_DIR + "/")) { res = StringUtils.strip(res, BTableConstants.SYSTEM_DIR + "/"); if (res.startsWith(BTableConstants.PLUGIN_SYSTEM_DIR.toLowerCase() + "/")) { filePath = filePath.replaceFirst( BTableConstants.SYSTEM_DIR + "/" + BTableConstants.PLUGIN_SYSTEM_DIR + "/", ""); return factory.getPluginSystemReader(basePath).fetchFile(filePath); } else { String pluginId = res.substring(0, filePath.indexOf("/")); filePath = filePath.replaceFirst(BTableConstants.SYSTEM_DIR + "/" + pluginId + "/", ""); return factory.getOtherPluginSystemReader(pluginId, basePath).fetchFile(filePath); } } else if (res.startsWith(BTableConstants.PLUGIN_REPOSITORY_DIR.toLowerCase() + "/")) { filePath = filePath.replaceFirst(BTableConstants.PLUGIN_REPOSITORY_DIR + "/", ""); return factory.getPluginRepositoryReader(basePath).fetchFile(filePath); } else { if (factory.getPluginSystemReader(basePath).fileExists(filePath)) { return factory.getPluginSystemReader(basePath).fetchFile(filePath); } else if (factory.getUserContentAccess(basePath).fileExists(filePath)) { return factory.getUserContentAccess(basePath).fetchFile(filePath); } } return null; }
From source file:com.ms.app.web.commons.utils.DeviceUtils.java
/** * ?UA??/*from ww w. j a v a 2 s . co m*/ * * @param ua * @return */ public static WebBrowserEnum getBowser(String ua) { if (StringUtils.isEmpty(ua)) { return null; } ua = ua.toLowerCase(); if (ua.contains("msie")) { return WebBrowserEnum.IE; } if (ua.contains("chrome")) { return WebBrowserEnum.CHROME; } if (ua.contains("firefox")) { return WebBrowserEnum.FIREFOX; } if (ua.contains("safari")) { return WebBrowserEnum.SAFARI; } if (ua.contains("opera")) { return WebBrowserEnum.OPERA; } return null; }
From source file:com.microsoft.alm.plugin.idea.common.utils.EventContextHelper.java
public static Map<String, Object> createContext(final String sender) { final Map<String, Object> eventContext = new HashMap<String, Object>(); if (!StringUtils.isEmpty(sender)) { setSender(eventContext, sender); }/* w w w . j a v a2 s. c om*/ return eventContext; }
From source file:com.dianping.simple.spring.TestPropertyEditor.java
public void setAsText(String text) { if (StringUtils.isEmpty(text)) { throw new IllegalArgumentException("error text formatter"); }/*from w w w .ja va2 s . co m*/ String[] infos = text.split(","); Test test = new Test(); test.setName(infos[0]); test.setAge(Integer.parseInt(infos[1])); setValue(test); }
From source file:fi.vm.sade.organisaatio.api.DateParam.java
@Override protected Date parse(String param) throws Throwable { if (StringUtils.isEmpty(param)) { return null; }// w w w. ja v a 2 s .c om final DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); try { return dateFormat.parse(param); } catch (ParseException e) { throw new WebApplicationException(Response.status(Status.BAD_REQUEST) .entity("Couldn't parse date string: " + e.getMessage()).build()); } }
From source file:com.zxy.commons.lang.utils.ObjectsUtils.java
/** * ?/*from w w w . j a va 2s. c om*/ * * @param obj * @return ? */ public static boolean isEmpty(Object obj) { if (obj == null) { return true; } if (obj.toString().length() == 0) { return true; } return StringUtils.isEmpty(obj.toString()); }
From source file:com.npower.wall.TagUtil.java
/** * Get the UA from request if any otherwise use the parameter passed *//*from ww w . j av a 2s . c o m*/ public static String getUA(HttpServletRequest request) { String UA = ""; if (request.getParameter("UA") != null) { UA = request.getParameter("UA"); } else { UA = request.getHeader("User-Agent"); } if (StringUtils.isEmpty(UA)) { // Default UA UA = "Nokia6681"; } return UA; }
From source file:cz.strmik.cmmitool.web.controller.propertyeditor.UserEditor.java
@Override public void setAsText(String text) { if (StringUtils.isEmpty(text)) { setValue(null);/*w w w . ja v a 2s . c o m*/ } else { setValue(userDao.findUser(text)); } }
From source file:info.magnolia.cms.util.PathUtil.java
public static String createPath(String path, String label) { String res;//w w w . j a v a2 s. co m if (StringUtils.isEmpty(path) || (path.equals("/"))) { //$NON-NLS-1$ res = label; } else { res = path + "/" + label; } return addLeadingSlash(res); }