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:mitm.common.util.HexUtils.java
/** * Returns true if the input is hex. If hex is null or empty false is returned. Pending or trailing * white-spaces are ignored./*from w ww . j a v a 2 s.c om*/ */ public static boolean isHex(String hex) { if (StringUtils.isBlank(hex)) { return false; } return HEX_PATTERN.matcher(hex).matches(); }
From source file:bazaar4idea.command.BzrTagCreateCommand.java
public BzrStandardResult execute() throws BzrCommandException { if (StringUtils.isBlank(tagName)) { throw new BzrCommandException("tag name is empty"); }/*from ww w . j av a 2 s . c o m*/ return ShellCommandService.getInstance(project).execute2(repo, "tag", Arrays.asList(tagName)); }
From source file:com.doculibre.constellio.feedprotocol.model.impl.FeedMetaImpl.java
public FeedMetaImpl(String name, String content) throws ParseFeedException { if (StringUtils.isBlank(name)) { throw new ParseFeedException("Blank name"); }//from w ww .j a va2 s . c o m this.name = name; if (StringUtils.isBlank(content)) { //Blank content. content = ""; } this.content = content; }
From source file:com.razorfish.forms.ExtendedRegistrationValidator.java
@Override public void validate(final Object object, final Errors errors) { super.validate(object, errors); final RegisterForm registerForm = (RegisterForm) object; final String mobileNumber = registerForm.getMobileNumber(); if (!StringUtils.isBlank(mobileNumber) && !isMobileNumberValid(mobileNumber)) { errors.rejectValue("mobileNumber", "register.mobileNumber.invalid"); }// www. j a v a 2s. com }
From source file:com.falcon.orca.data.generators.impl.StringGenerator.java
@Override public String next() { if (StringUtils.isBlank(characters)) { if (letters && numbers) { return RandomStringUtils.randomAlphanumeric(length); } else {//from w ww . j ava2s .c om if (letters) { return RandomStringUtils.randomAlphabetic(length); } else if (numbers) { return RandomStringUtils.randomAlphanumeric(length); } } } else { return RandomStringUtils.random(length, 0, characters.length(), letters, numbers, characters.toCharArray()); } return ""; }
From source file:ar.com.zauber.commons.web.utils.impl.IdSEOIdStrategy.java
/** @see SEOIdStrategy#getIdFromSEOFriendly(String) */ public final Serializable getIdFromSEOFriendly(final String l) { return StringUtils.isBlank(l) ? null : l.equals(allMark) ? null : Long.parseLong(l); }
From source file:ar.com.zauber.commons.spring.beans.factory.impl.BooleanSystemPropertyCaseBlock.java
/** @param propertyName propiedad a evaluar */ public BooleanSystemPropertyCaseBlock(final String propertyName, final Object object) { Validate.isTrue(!StringUtils.isBlank(propertyName)); Validate.notNull(object);//from w ww . j a va2 s. c o m this.propertyName = propertyName; this.object = object; }
From source file:com.evolveum.liferay.usercreatehook.ws.WSConfig.java
public static String getEndPointUrl() { String result = PropsUtil.get(PROPERTY_WS_ENDPOINT_URL); if (StringUtils.isBlank(result)) { result = DEFAULT_ENDPOINT_URL; LOG.info("Property '" + PROPERTY_WS_ENDPOINT_URL + "' not found in hook's portal.properties - using default value '" + result + "'"); } else {/*from w w w . j a v a2 s . c o m*/ LOG.debug("Property '" + PROPERTY_WS_ENDPOINT_URL + "' value: '" + result + "'"); } return result; }
From source file:au.org.ala.biocache.dto.OccurrenceSource.java
public static OccurrenceSource getForDisplayName(String name) { if (StringUtils.isBlank(name)) return null; return displayNameLookup.get(name.toLowerCase()); }
From source file:com.baidu.rigel.biplatform.ac.util.TimeDimensionUtils.java
/** * ??/* w ww .j ava 2 s.c o m*/ * * @param timeStr * @param timeType ?? * @param timeFormat ?? * @return timeMember ?member * @throws ParseException parse? */ public static MiniCubeMember createTimeMember(String timeStr, TimeType timeType, String timeFormat) throws ParseException { if (StringUtils.isBlank(timeStr) && timeType == null) { throw new IllegalArgumentException( "timeStr is blank or timeType is null, timeStr:" + timeStr + " timeType:" + timeType); } Calendar calendar = null; String dateFormat = StringUtils.isBlank(timeFormat) ? timeType.getFormat() : timeFormat; if (dateFormat.toUpperCase().contains("QN")) { int year = Integer.parseInt(timeStr.substring(0, 4)); int quarter = Integer.parseInt(timeStr.substring(5)); // Calendar?1 int month = (quarter - 1) * 3; calendar = new GregorianCalendar(year, month, 1); } else { SimpleDateFormat sdf = new SimpleDateFormat(dateFormat); Date date = sdf.parse(timeStr); calendar = Calendar.getInstance(); calendar.setTime(date); } int quarter = calendar.get(Calendar.MONTH) / 3 + 1; String caption = null; MiniCubeLevel level = new MiniCubeLevel("level_" + timeType); if (timeType.equals(TimeType.TimeYear)) { caption = calendar.get(Calendar.YEAR) + ""; level.setType(LevelType.TIME_YEARS); } else if (timeType.equals(TimeType.TimeQuarter)) { caption = calendar.get(Calendar.YEAR) + "_Q" + quarter; level.setType(LevelType.TIME_QUARTERS); } else if (timeType.equals(TimeType.TimeMonth)) { caption = calendar.get(Calendar.YEAR) + "_" + (calendar.get(Calendar.MONTH) + 1); level.setType(LevelType.TIME_MONTHS); } else if (timeType.equals(TimeType.TimeWeekly)) { caption = calendar.get(Calendar.YEAR) + "_W" + calendar.get(Calendar.WEEK_OF_YEAR); level.setType(LevelType.TIME_WEEKS); } else if (timeType.equals(TimeType.TimeDay)) { caption = DEFAULT_SIMPLE_DATEFORMAT.format(calendar.getTime()); level.setType(LevelType.TIME_DAYS); } MiniCubeMember member = new MiniCubeMember(timeStr); member.setCaption(caption); member.setVisible(true); member.setLevel(level); LOG.info("time member:" + member); return member; }