List of usage examples for org.apache.commons.lang3 StringUtils isNotEmpty
public static boolean isNotEmpty(final CharSequence cs)
Checks if a CharSequence is not empty ("") and not null.
StringUtils.isNotEmpty(null) = false StringUtils.isNotEmpty("") = false StringUtils.isNotEmpty(" ") = true StringUtils.isNotEmpty("bob") = true StringUtils.isNotEmpty(" bob ") = true
From source file:costumetrade.common.util.IPUtils.java
public static String getClientIpAddress(HttpServletRequest request) { if (request == null) { return ""; }//from ww w . jav a2 s.com for (String header : HEADERS_TO_TRY) { String ip = request.getHeader(header); if (StringUtils.isNotEmpty(ip) && !"unknown".equalsIgnoreCase(ip)) { return ip; } } return request.getRemoteAddr(); }
From source file:com.mirth.connect.util.AttachmentUtil.java
public static void writeToFile(String filePath, Attachment attachment, boolean binary) throws IOException { File file = new File(filePath); if (!file.canWrite()) { String dirName = file.getPath(); int i = dirName.lastIndexOf(File.separator); if (i > -1) { dirName = dirName.substring(0, i); File dir = new File(dirName); dir.mkdirs();// w w w.j av a2 s.c o m } file.createNewFile(); } if (attachment != null && StringUtils.isNotEmpty(filePath)) { FileUtils.writeByteArrayToFile(file, binary ? Base64Util.decodeBase64(attachment.getContent()) : attachment.getContent()); } }
From source file:badminton.common.Util.StringUtil.java
/** * <p>//from www. j a va 2 s . c om * Checks if a String is not empty ("") and not null. * </p> * * @param obj * the String to check, may be null * @return <code>true</code> if the String is not empty and not null */ public static boolean isNotEmpty(final String obj) { return StringUtils.isNotEmpty(obj); }
From source file:com.sec.ose.airs.controller.cli.CLIMain.java
private static void setProxy(CLICommandLogin cm) { if (StringUtils.isNotEmpty(cm.getProxyHost())) { System.setProperty("http.proxyHost", cm.getProxyHost()); if (StringUtils.isNotEmpty(cm.getProxyPort())) { System.setProperty("http.proxyPort", cm.getProxyPort()); }// w w w . j av a 2 s . c o m } }
From source file:com.glaf.core.util.ClassUtils.java
public static void addClassInCache(String className, Class<?> cls) { if (StringUtils.isNotEmpty(className) && cls != null) { ClassUtils.cache.put(className, cls); }//from w w w . j a va 2 s . c om }
From source file:com.sixt.service.framework.FeatureFlags.java
public static boolean shouldExposeErrorsToHttp(ServiceProperties serviceProps) { String value = serviceProps.getProperty(FLAG_EXPOSE_ERRORS_HTTP); if (StringUtils.isNotEmpty(value) && Boolean.valueOf(value)) { return true; } else {//from w ww. ja v a 2 s. c o m return false; } }
From source file:alfio.controller.support.SessionUtil.java
public static void saveSpecialPriceCode(String specialPriceCode, HttpServletRequest request) { if (StringUtils.isNotEmpty(specialPriceCode)) { request.getSession().setAttribute(SPECIAL_PRICE_CODE_SESSION_ID, UUID.randomUUID().toString()); request.getSession().setAttribute(SPECIAL_PRICE_CODE, specialPriceCode); }/* www. j a v a 2 s. c o m*/ }
From source file:com.twosigma.beaker.shared.module.util.ControlCharacterUtils.java
public static boolean containsControlCharacters(final String value) { if (StringUtils.isNotEmpty(value)) { for (int i = 0; i < value.length(); i++) { char c = value.charAt(i); if (!Character.isWhitespace(c) && Character.isISOControl(c)) { return true; }/*from w w w .ja v a2 s . co m*/ } } return false; }
From source file:cherry.example.web.util.ViewNameUtil.java
public static String fromMethodCall(Object invocationInfo) { MethodInvocationInfo info = (MethodInvocationInfo) invocationInfo; Method method = info.getControllerMethod(); Class<?> type = method.getDeclaringClass(); UriComponentsBuilder ucb = UriComponentsBuilder.newInstance(); String typePath = getMappedPath(type.getAnnotation(RequestMapping.class)); if (StringUtils.isNotEmpty(typePath)) { ucb.path(typePath);//from w w w.j ava2 s. co m } String methodPath = getMappedPath(method.getAnnotation(RequestMapping.class)); if (StringUtils.isNotEmpty(methodPath)) { ucb.pathSegment(methodPath); } String path = ucb.build().getPath(); if (path.startsWith("/")) { return path.substring(1); } return path; }
From source file:cc.linkedme.commons.useragent.OS.java
public static String getOsVersion(String family, String major, String minor, String patch) { if (family.equals("iOS")) { if (StringUtils.isNotEmpty(major) && StringUtils.isNotEmpty(minor)) { return major + "_" + minor; }/*from w ww.java2 s . c o m*/ if (StringUtils.isNotEmpty(major) && StringUtils.isNotEmpty(minor) && StringUtils.isNotEmpty(patch)) { return major + "_" + minor + "_" + patch; } } if (family.equals("Android")) { if (StringUtils.isNotEmpty(major) && StringUtils.isNotEmpty(minor)) { return major + "." + minor; } if (StringUtils.isNotEmpty(major) && StringUtils.isNotEmpty(minor) && StringUtils.isNotEmpty(patch)) { return major + "." + minor + "." + patch; } } return null; }