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:de.fhg.iais.asc.sipmaker.SipMakerKey.java
public static SipMakerKey fromTrunk(String metadataFormat, List<String> subFormats) { if (StringUtils.isEmpty(metadataFormat)) { throw new IllegalArgumentException("Metadata format may not be empty"); }//from www .j a va2 s . co m String current = metadataFormat; List<String> result = new ArrayList<String>(); result.add(current); for (String dir : subFormats) { if (!StringUtils.isEmpty(dir)) { current = current.concat(File.separator).concat(dir); result.add(current); } } Collections.reverse(result); result = Collections.unmodifiableList(result); return new SipMakerKey(result, ""); }
From source file:acromusashi.stream.config.ConfigValidation.java
/** * ????<br>//from w ww.ja va 2 s.com * ??:??????????????????? * * @param value * @return ???true?????false */ public static boolean isServerAddress(Object value) { //null????? if (value == null) { return false; } // String???? if (String.class.isAssignableFrom(value.getClass()) == false) { return false; } // ????? String valueString = (String) value; if (StringUtils.isEmpty(valueString)) { return false; } // :???????? String[] redisConfig = valueString.split(SERVER_ADDRESS_SEPARATER); if (redisConfig.length < 2) { return false; } // ???int??????? try { Integer.valueOf(redisConfig[1]); return true; } catch (NumberFormatException ex) { return false; } }
From source file:jp.co.nemuzuka.utils.BinaryHexConverter.java
/** * 16?Byte????/*from w w w . ja v a 2 s .c o m*/ * @param fromHexStr ??16 * @return ??Byte?(??16?null????null) */ public static byte[] hexStringToBytes(String fromHexStr) { if (StringUtils.isEmpty(fromHexStr)) { return null; } //16??2?1?????? //Byte???????????1/2?? byte[] toByte = new byte[fromHexStr.length() / 2]; //16?2??Byte??????? for (int i = 0; i < toByte.length; i++) { toByte[i] = (byte) Integer.parseInt(fromHexStr.substring(i * 2, (i + 1) * 2), 16); } return toByte; }
From source file:cn.loveapple.service.util.DateUtil.java
/** * ???/*from www .jav a2s . co m*/ * * @see SimpleDateFormat ??? * @param source ? * @param pattern * @return ????????<code>null</code>????????? */ public static Date paseDate(String source, String pattern) { if (StringUtils.isEmpty(source) || StringUtils.isEmpty(pattern)) { return null; } try { SimpleDateFormat format = new SimpleDateFormat(pattern); return format.parse(source); } catch (Exception e) { return null; } }
From source file:com.intuit.tank.vm.common.util.ValidationUtil.java
/** * Is the string specified in the proper function format * //from w ww . j a v a 2 s .c o m * @param function * True if it starts with the function identifier; FALSE otherwise * @return */ public static boolean isFunction(String function) { if (StringUtils.isEmpty(function)) { return false; } if (function.startsWith(functionIdentifier)) { return true; } return false; }
From source file:io.cloudslang.lang.compiler.modeller.transformers.DependencyFormatValidator.java
void validateDependency(String dependency) { String[] gavParts = dependency.split(":"); if (gavParts.length != DEPENDENCY_PARTS || StringUtils.isEmpty(gavParts[0].trim()) || StringUtils.isEmpty(gavParts[1].trim()) || StringUtils.isEmpty(gavParts[2].trim())) { throw new RuntimeException(INVALID_DEPENDENCY); }// w ww .jav a 2 s .c om }
From source file:com.pureinfo.srm.project.action.outlay.OutlayAssginDeleteAction.java
protected ActionForward beforeExecution() throws PureException { String sIds = request.getTrimedParameter(ArkWebConstants.REQ_OBJ_ID); if (StringUtils.isEmpty(sIds)) { logger.debug("the id is null."); return super.beforeExecution(); }// w w w .ja v a 2 s . c o m IOutlayAssginDetailMgr detailMgr = (IOutlayAssginDetailMgr) ArkContentHelper .getContentMgrOf(OutlayAssginDetail.class); String[] ids = sIds.split(","); for (int i = 0; i < ids.length; i++) { int id = StrConvertor.strToInt(ids[i], "id", 0); detailMgr.deleteByAssginId(id); } request.setAttribute("forward", ""); return null; }
From source file:edu.northwestern.bioinformatics.studycalendar.web.NewSiteCommand.java
public Site createSite() throws Exception { if (site.getAssignedIdentifier() == null || StringUtils.isEmpty(site.getAssignedIdentifier())) { site.setAssignedIdentifier(site.getName()); }/*from w ww .ja v a 2 s . c o m*/ return siteService.createOrUpdateSite(site); }
From source file:com.devnexus.ting.web.converter.StringToSponsorLevel.java
@Override public SponsorLevel convert(String source) { if (StringUtils.isEmpty(source) || !StringUtils.isNumeric(source)) { return null; } else {//from w w w . ja v a2 s . c om return SponsorLevel.fromId(Long.valueOf(source)); } }
From source file:net.shopxx.dao.impl.CouponCodeDaoImpl.java
public boolean codeExists(String code) { if (StringUtils.isEmpty(code)) { return false; }/*from w ww. j a v a 2 s . co m*/ String jpql = "select count(*) from CouponCode couponCode where lower(couponCode.code) = lower(:code)"; Long count = entityManager.createQuery(jpql, Long.class).setParameter("code", code).getSingleResult(); return count > 0; }