List of usage examples for org.apache.commons.lang3 StringUtils isEmpty
public static boolean isEmpty(final CharSequence cs)
Checks if a CharSequence is empty ("") or null.
StringUtils.isEmpty(null) = true StringUtils.isEmpty("") = true StringUtils.isEmpty(" ") = false StringUtils.isEmpty("bob") = false StringUtils.isEmpty(" bob ") = false
NOTE: This method changed in Lang version 2.0.
From source file:com.astamuse.asta4d.util.i18n.LocalizeUtil.java
public static Locale getLocale(String localeStr) { if (StringUtils.isEmpty(localeStr)) { return null; }//from ww w . ja va 2 s . co m try { return LocaleUtils.toLocale(localeStr); } catch (IllegalArgumentException e) { return null; } }
From source file:com.astamuse.asta4d.web.form.flow.classical.MultiStepFormFlowSnippet.java
@Override protected boolean renderForEdit(String step, Object form, String fieldName) { if (StringUtils.isEmpty(step)) { return true; } else {//from w ww . j av a 2 s.co m return !NonEditSteps.contains(step.toLowerCase()); } }
From source file:io.cloudslang.content.httpclient.build.RequestConfigBuilder.java
public RequestConfigBuilder setSocketTimeout(String socketTimeout) { if (!StringUtils.isEmpty(socketTimeout)) { this.socketTimeout = socketTimeout; }/* w w w . j a v a 2 s. co m*/ return this; }
From source file:jease.cms.web.content.editor.LinkEditor.java
public void validate() { validate(StringUtils.isEmpty(link.getValue()), I18N.get("Url_is_required")); }
From source file:com.gdo.stencils.cond.LinkCondition.java
/** * Tests if a condition is to retrieve the adaptor directly. *///ww w . j a va 2 s .c o m public static <C extends _StencilContext, S extends _PStencil<C, S>> boolean isWithLinksCondition(C stclContext, S link, StencilCondition<C, S> cond) { if (cond instanceof PathCondition) { String path = ((PathCondition<C, S>) cond).getCondition(); if (PathUtils.isKeyContained(path)) { String key = PathUtils.getKeyContained(path); if (StringUtils.isNotEmpty(key) && key.startsWith("$")) { String c = key.substring(1); if (StringUtils.isEmpty(c)) return true; PathCondition<C, S> p = PathCondition.newKeyCondition(stclContext, new Key(c), link); return p.verify(stclContext, link); } } else if (PathUtils.isExpContained(path)) { String exp = PathUtils.getExpContained(path); if (StringUtils.isNotEmpty(exp) && exp.startsWith("$")) { String c = exp.substring(1); if (StringUtils.isEmpty(c)) return true; PathCondition<C, S> p = PathCondition.newExpCondition(stclContext, c, link); return p.verify(stclContext, link); } } } return false; }
From source file:costumetrade.common.verify.SmsService.java
@Override public boolean valid(String businessKey, String code) { String key = buildKey(businessKey); String smsCode = (String) redisTemplate.opsForValue().get(key); if (StringUtils.isEmpty(smsCode)) { return false; }//from www .j a va2 s . com boolean result = smsCode.equals(code); if (result) { redisTemplate.delete(key); } return result; }
From source file:ctrus.pa.util.CtrusHelper.java
public static final CharSequence uniqueId(String s) { if (s == null || StringUtils.isEmpty(s)) throw new IllegalArgumentException("Input cannot be null or empty"); //long idNum = MurmurHash2.hash64(sClean); long idNum = FNVHash.newHashFunction().hash64(s.getBytes()); idNum = idNum < 0 ? -idNum : idNum; String uid = ""; long mod = 0; int division = 17; while (idNum != 0) { mod = idNum % division;//from w ww. j ava 2 s .c o m uid = $baseDigits.substring((int) mod, (int) mod + 1) + uid; idNum = idNum / division; } return uid; }
From source file:com.hbc.api.trade.order.controller.validator.OrderValidator.java
public static void validateDeliverGuide(String allocateGid, String orderNo, String refuseReason, String guideId) {/* www. j a v a 2s . c o m*/ validateDeliverGuide(allocateGid, orderNo, guideId); if (StringUtils.isEmpty(refuseReason)) { logger.error("refuseReason nullrefuseReason=" + refuseReason); throw new TradeException(TradeReturnCodeEnum.ORDER_PARAM_FAILED, "refuseReason"); } }
From source file:alluxio.underfs.glusterfs.GlusterFSUnderFileSystemContractTest.java
@Override public UnderFileSystem createUfs(String path, UnderFileSystemConfiguration conf) throws Exception { if (StringUtils.isEmpty(conf.getValue(PropertyKey.UNDERFS_GLUSTERFS_MOUNTS))) { throw new IllegalArgumentException("Gluster FS Mounts are undefined"); }/* w w w.j av a2 s . c om*/ if (StringUtils.isEmpty(conf.getValue(PropertyKey.UNDERFS_GLUSTERFS_VOLUMES))) { throw new IllegalArgumentException("Gluster FS Volumes are undefined"); } return new GlusterFSUnderFileSystemFactory().create(path, conf); }
From source file:com.bekwam.resignator.commands.SignCommand.java
public void signJAR(Path jarFilePath, Path keystore, String storepass, String alias, String keypass, Consumer<String> observer) throws CommandExecutionException { if (StringUtils.isEmpty(storepass)) { throw new CommandExecutionException("storepass is required"); }//from w ww.j a va 2 s. co m if (StringUtils.isEmpty(keypass)) { throw new CommandExecutionException("keypass is required"); } if (StringUtils.isEmpty(alias)) { throw new CommandExecutionException("alias is required"); } if (keystore == null) { throw new CommandExecutionException("keystore is required"); } if (jarFilePath == null) { throw new CommandExecutionException("jarFilePath is required"); } if (!jarFilePath.toFile().exists()) { throw new CommandExecutionException(String.format("jar file %s not found", jarFilePath.toString())); } Preconditions.checkNotNull(activeConfiguration.getJarsignerCommand()); observer.accept("Running jarsigner command on '" + jarFilePath.toString() + "'"); String[] cmdAndArgs = { activeConfiguration.getJarsignerCommand().toString(), "-keystore", keystore.toString(), "-storepass", storepass, "-keypass", keypass, "-tsa", "http://timestamp.digicert.com", jarFilePath.toString(), alias }; CommandExecutor cmd = new CommandExecutor(); cmd.exec(cmdAndArgs); observer.accept("Finished"); }