List of usage examples for org.apache.commons.lang3 StringUtils isNotBlank
public static boolean isNotBlank(final CharSequence cs)
Checks if a CharSequence is not empty (""), not null and not whitespace only.
StringUtils.isNotBlank(null) = false StringUtils.isNotBlank("") = false StringUtils.isNotBlank(" ") = false StringUtils.isNotBlank("bob") = true StringUtils.isNotBlank(" bob ") = true
From source file:com.msopentech.odatajclient.engine.data.atom.AtomDeserializer.java
private static void common(final Element input, final AtomObject object) { if (StringUtils.isNotBlank(input.getAttribute(ODataConstants.ATTR_XMLBASE))) { object.setBaseURI(input.getAttribute(ODataConstants.ATTR_XMLBASE)); }/*from w w w . j a v a 2 s.c o m*/ final List<Element> ids = XMLUtils.getChildElements(input, ODataConstants.ATOM_ELEM_ID); if (!ids.isEmpty()) { object.setId(ids.get(0).getTextContent()); } final List<Element> titles = XMLUtils.getChildElements(input, ODataConstants.ATOM_ELEM_TITLE); if (!titles.isEmpty()) { object.setTitle(titles.get(0).getTextContent()); } final List<Element> summaries = XMLUtils.getChildElements(input, ODataConstants.ATOM_ELEM_SUMMARY); if (!summaries.isEmpty()) { object.setSummary(summaries.get(0).getTextContent()); } final List<Element> updateds = XMLUtils.getChildElements(input, ODataConstants.ATOM_ELEM_UPDATED); if (!updateds.isEmpty()) { try { object.setUpdated(ISO_DATEFORMAT.parse(updateds.get(0).getTextContent())); } catch (Exception e) { LOG.error("Could not parse date {}", updateds.get(0).getTextContent(), e); } } }
From source file:co.runrightfast.core.utils.ConfigUtils.java
static String configPath(final String name, final String... names) { checkArgument(StringUtils.isNotBlank(name)); if (ArrayUtils.isNotEmpty(names)) { return ConfigUtil.joinPath(ImmutableList.<String>builder().add(name).add(names).build()); }// w ww. j a v a 2s .com return name; }
From source file:com.omnigon.aem.common.utils.LocaleUtils.java
public static Locale getLocale(String code) { return StringUtils.isNotBlank(code) ? LanguageUtil.getLocale(code) : null; }
From source file:com.kixeye.chassis.transport.crypto.SymmetricKeyCryptoUtils.java
/** * Loads a cipher.//from ww w .ja v a 2 s. c o m * * @param transformation * @param provider * @return * @throws GeneralSecurityException */ public static Cipher loadCipher(String transformation, String provider) throws GeneralSecurityException { if (StringUtils.isNotBlank(provider)) { return Cipher.getInstance(transformation, provider); } else { return Cipher.getInstance(transformation); } }
From source file:com.ihelin.book.db.plugin.MySQLDialect.java
public String getLimitString(String sql, int offset, String offsetPlaceholder, int limit, String limitPlaceholder) { String limitStr = StringUtils.EMPTY; if (StringUtils.isNotBlank(sql)) { limitStr = sql + DEF_SQL_LIMIT;/*from w w w .j a v a 2 s .com*/ if (offset > 0) { limitStr += offsetPlaceholder + DEF_SQL_LIMIT_CONNECTOR + limitPlaceholder; } else { limitStr += limitPlaceholder; } } return limitStr; }
From source file:com.thinkbiganalytics.jobrepo.rest.controller.QueryUtils.java
public static PageRequest pageRequest(Integer start, Integer limit, String sort) { if (StringUtils.isNotBlank(sort)) { Sort.Direction dir = Sort.Direction.ASC; if (sort.startsWith("-")) { dir = Sort.Direction.DESC;/*from ww w. java 2 s .co m*/ sort = sort.substring(1); } return new PageRequest((start / limit), limit, dir, sort); } else { return new PageRequest((start / limit), limit); } }
From source file:com.monarchapis.driver.util.MediaTypeUtils.java
/** * Returns the best media type for a specific API request. * /*from w w w. ja v a 2s. c o m*/ * @return the media type. */ public static String getBestMediaType(ApiRequest request) { String mediaType = null; String accept = request.getHeader("Accept"); if (StringUtils.isNotBlank(accept)) { mediaType = MIMEParse.bestMatch(supportedMimeTypes, accept); } if (StringUtils.isBlank(mediaType)) { mediaType = MediaType.APPLICATION_JSON; } return mediaType; }
From source file:io.seldon.importer.articles.AttributesImporterUtils.java
public static Set<String> getTags(Document articleDoc, String tagsCssSelector, String title) { Set<String> tagSet = new HashSet<String>(); if (StringUtils.isNotBlank(tagsCssSelector)) { Elements tagsElements = articleDoc.select(tagsCssSelector); Element tagsElement = tagsElements.first(); List<String> tagsParts; if ((tagsElement != null) && (tagsElement.attr("content") != null) && (StringUtils.isNotBlank(tagsElement.attr("content")))) { tagsParts = AttributesImporterUtils.getTagsPartsFromSingleElement(tagsElement); } else {// w w w . j a va2s . c om tagsParts = AttributesImporterUtils.getTagsPartsFromMultipleElement(tagsElements); } List<String> extraTagsParts = AttributesImporterUtils.createExtraTagsPartsFromTitle(title, tagsParts); tagSet.addAll(tagsParts); tagSet.addAll(extraTagsParts); } return tagSet; }
From source file:com.hybris.mobile.app.commerce.helper.ProductHelper.java
/** * Redirect to the product details page//from ww w . j a v a2 s. c o m * * @param context * @param productCode */ public static void redirectToProductDetail(Context context, String productCode) { if (StringUtils.isNotBlank(productCode)) { Intent intentProductDetail = new Intent(context, ProductDetailActivity.class); intentProductDetail.putExtra(IntentConstants.PRODUCT_CODE, productCode); context.startActivity(intentProductDetail); } }
From source file:com.github.utils.mycollect.util.EmojiUtil.java
/** * Emoji/*from ww w . j a v a 2s.c om*/ * * @param content * @return */ public static String filterEmoji(String content) { StringBuilder result = new StringBuilder(); if (StringUtils.isNotBlank(content)) { for (int i = 0; i < content.length(); i++) { char c = content.charAt(i); //CJK Compatibility,?? Integer cInt = Integer.valueOf(c); if (cInt > 9470 && cInt < 12288) { if (Integer.valueOf(content.charAt(i + 1)) == 65039) { i++; } continue; } if (!isEmojiCharacter(c)) { result.append(c); } } } return result.toString(); }