List of usage examples for org.apache.commons.lang3 StringUtils isBlank
public static boolean isBlank(final CharSequence cs)
Checks if a CharSequence is whitespace, empty ("") or null.
StringUtils.isBlank(null) = true StringUtils.isBlank("") = true StringUtils.isBlank(" ") = true StringUtils.isBlank("bob") = false StringUtils.isBlank(" bob ") = false
From source file:com.nortal.petit.converter.BaseFromStringConverter.java
@Override protected T convertNotNull(String value) { if (StringUtils.isBlank(value)) { return null; }/*from w ww . j av a 2s.c om*/ return convertNotBlank(value); }
From source file:com.netflix.imfutility.itunes.locale.LocaleHelper.java
public static Locale ensureDefaultRegion(String lang) { if (StringUtils.isBlank(lang)) { return null; }/* w w w. j av a 2s . c o m*/ if (DEFAULT_REGIONS.containsKey(lang)) { return DEFAULT_REGIONS.get(lang); } else { return fromITunesLocale(lang); } }
From source file:com.alliander.osgp.adapter.protocol.oslp.device.FirmwareLocation.java
/** * Create a new instance of {@link FirmwareLocation}. * * @param domain/*from ww w.j a v a 2 s .co m*/ * the domain on which the firmware is located. * @param path * the path on which the firmware is located. * @param fileExtension * the file extension of the firmware. */ public FirmwareLocation(final String domain, final String path) { if (StringUtils.isBlank(domain)) { throw new IllegalArgumentException("Domain is empty or null."); } this.domain = cleanUpDomain(domain); this.path = cleanUpPath(path); }
From source file:co.tuzza.swipehq.fields.CurrencyConverter.java
@Override public Currency convert(String value) { if (StringUtils.isBlank(value)) { return null; }//from ww w . jav a 2 s . c o m return Currency.findByAny(value); }
From source file:com.erudika.para.email.MockEmailer.java
public boolean sendEmail(List<String> emails, String subject, String body) { if (emails != null && !emails.isEmpty() && !StringUtils.isBlank(body)) { return true; }/*from w ww. j a v a2 s .c o m*/ return false; }
From source file:com.netsteadfast.greenstep.util.ControllerAuthorityCheckUtils.java
public static boolean isControllerAuthority(Annotation[] actionAnnotations, Annotation[] actionMethodAnnotations, Subject subject) { if (actionAnnotations != null && actionAnnotations.length > 0) { for (Annotation anno : actionAnnotations) { if (anno instanceof ControllerAuthority) { if (!((ControllerAuthority) anno).check()) { // check=false , ??? return true; }/*from w w w .ja v a 2 s .c o m*/ } if (anno instanceof SystemForm) { String progId = (String) ServletActionContext.getRequest().getParameter("prog_id"); if (StringUtils.isBlank(progId)) { // COMMON FORM prog_id ?? return false; } if (subject.isPermitted(progId)) { return true; } } } } if (actionMethodAnnotations != null && actionMethodAnnotations.length > 0) { for (Annotation anno : actionMethodAnnotations) { if (anno instanceof ControllerMethodAuthority) { String progId = ((ControllerMethodAuthority) anno).programId(); if (StringUtils.isBlank(progId)) { return false; } if (subject.isPermitted(progId)) { return true; } } } } return false; }
From source file:com.github.rvesse.airline.builder.AliasBuilder.java
public AliasBuilder(String name) { if (StringUtils.isBlank(name)) throw new IllegalArgumentException("Alias name cannot be null/empty/whitespace"); this.name = name; }
From source file:com.trenako.validation.AddressValidator.java
private static boolean invalidPostalCode(Address a) { return StringUtils.isBlank(a.getPostalCode()); }
From source file:com.thoughtworks.go.validation.EmailValidator.java
public ValidationBean validate(String address) { if (StringUtils.isBlank(address)) { return ValidationBean.valid(); }/* w w w . ja va 2s.c o m*/ if (address.matches(".*@" + HostnameValidator.HOSTNAME_PATTERN)) { return ValidationBean.valid(); } return ValidationBean.notValid(EMAIL_ERROR_MESSAGE); }
From source file:com.kingen.repository.log.LogDao.java
public Page<Log> findLogs(Page<Log> page, Log vo) { Map<String, Object> parameter = Maps.newHashMap(); StringBuilder hql = new StringBuilder("from Log where 1=1 "); //??? if (vo != null && !StringUtils.isBlank(vo.getUserAgent())) { hql.append(" and userAgent like :p1"); parameter.put("p1", "%" + vo.getUserAgent() + "%"); }/* ww w . j a v a 2 s . co m*/ if (vo != null && !StringUtils.isBlank(vo.getFromDate())) { hql.append(" and createDate >:p2"); parameter.put("p2", vo.getFromDate()); } if (vo != null && !StringUtils.isBlank(vo.getToDate())) { hql.append(" and createDate <= :p3"); parameter.put("p3", vo.getToDate()); } hql.append(" order by createDate desc"); return find(page, hql.toString(), parameter); }