List of usage examples for org.apache.commons.lang StringUtils isBlank
public static boolean isBlank(String str)
Checks if a String is whitespace, empty ("") or null.
From source file:com.baidu.rigel.biplatform.ma.model.utils.GsonUtils.java
/** * /*from w w w. j a v a 2s .c o m*/ * @param json * @param type * @return T */ public static <T> T fromJson(String json, Type type) { if (StringUtils.isBlank(json)) { return null; } return GSON.fromJson(json, type); }
From source file:com.ms.commons.utilities.StaticContentDeploy.java
public static synchronized void init() { String staticVersion = getStaticVersion(); if (StringUtils.isBlank(staticVersion) || StringUtils.equals(staticVersion, "0") || !staticVersion.matches("\\d+")) { staticVersion = StringUtils.EMPTY; }//from ww w.ja va2 s. c o m StaticContentDeploy.jsVersion = staticVersion; StaticContentDeploy.imgVersion = staticVersion; StaticContentDeploy.cssVersion = staticVersion; }
From source file:ezbake.data.graph.blueprints.schema.PropertyKeyParser.java
/** * Splits and validates a property key into schema identifier and property name. * * @param propertyKey the property key to split and validate * @return a {@code String[]} that contains 0: schema identifier and 1: property name *///w ww . j a v a2s . c om private static String[] getParsedPropertyKey(String propertyKey) { if (StringUtils.isBlank(propertyKey)) { throw new SchemaViolationException("Property key must not be blank!"); } final String[] keyComponents = propertyKey.split(SCHEMA_SEPARATOR); if (keyComponents.length != 2 || propertyKey.startsWith(SCHEMA_SEPARATOR)) { throw new SchemaViolationException(String .format("Schemas are required for properties! The following syntax is required for a property" + " key to be valid: '%s'", VALID_SCHEMA_KEY_FORMAT)); } return keyComponents; }
From source file:edu.duke.cabig.c3pr.utils.web.AuditInfoFilter.java
/** * @param httpReq// www.j ava 2 s. c o m */ public static void setAuditInfo(HttpServletRequest httpReq) { String userName = SecurityUtils.getUserName(); if (!StringUtils.isBlank(userName)) { log.debug("setting audit info for " + userName); gov.nih.nci.cabig.ctms.audit.DataAuditInfo .setLocal(new gov.nih.nci.cabig.ctms.audit.domain.DataAuditInfo(userName, httpReq.getRemoteAddr(), new Date(), httpReq.getRequestURI())); } else { log.debug("no authentication found in SecurityContext. Skipping audit info setup"); } }
From source file:com.redhat.victims.util.VictimsConfig.java
/** * Set configuration options for victims-lib * * @link https://github.com/victims/victims-lib-java#configuration-options *//*from w w w . j av a 2s .c om*/ public static void configureVictimsOptions() { Map<String, String> config = VictimsConfig.getProperties(); for (String key : config.keySet()) { //only set from properties if no JVM option if (StringUtils.isBlank(System.getProperty(key)) && StringUtils.isNotBlank(config.get(key))) { System.setProperty(key, config.get(key)); } } }
From source file:com.careerly.utils.TextUtils.java
/** * ? //w w w .j a v a2 s. c o m * * @param text ?? * @return ?? */ public static String convertTraditionalChineseNumber2ArabicNumber(String text) { if (StringUtils.isBlank(text)) { return StringUtils.EMPTY; } return StringUtils.replaceEach(text, new String[] { "", "", "", "??", "", "?", "", "", "?", "" }, new String[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" }); }
From source file:com.greenline.guahao.biz.manager.payment.util.AlipayMd5Encrypt.java
/** * //from ww w. j a v a 2 s .com * @param content * @param charset * @return byte * @throws SignatureException * @throws UnsupportedEncodingException */ private static byte[] getContentBytes(String content, String charset) { if (StringUtils.isBlank(charset)) { return content.getBytes(); } try { return content.getBytes(charset); } catch (UnsupportedEncodingException e) { throw new RuntimeException( "MD5??,??,??:" + charset); } }
From source file:ch.systemsx.cisd.openbis.generic.shared.translator.DataStoreTranslator.java
public static String translateDownloadUrl(String defaultDataStoreBaseURL, String downloadUrl) { if (StringUtils.isBlank(downloadUrl)) { return defaultDataStoreBaseURL; } else {// w ww . j av a 2 s . co m return downloadUrl + "/" + DATA_STORE_SERVER_WEB_APPLICATION_NAME; } }
From source file:com.enonic.cms.web.portal.instanttrace.InstantTraceRequestInspector.java
public static InstantTraceId getInstantTraceId(final Path path) { String s = path.getPathElementAfter(InstantTracePathInspector.TRACE_INFO_PATH_ELEMENTS); if (StringUtils.isBlank(s)) { return null; }//from w ww . j ava2 s .c o m return new InstantTraceId(s); }
From source file:com.activecq.api.utils.PathInfoUtil.java
/** * Get a named Query Parameter from the Request * * @param request//from www. j a va 2 s .com * @param key * @param dfault Value to return if Query Parameter value is blank * @return */ public static String getQueryParam(SlingHttpServletRequest request, String key, String dfault) { String tmp = request.getParameter(key); if (StringUtils.isBlank(tmp)) { return dfault; } return tmp; }