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.netflix.genie.common.dto.CommandStatus.java
/** * Parse command status./*from w w w . j ava 2s .c o m*/ * * @param value string to parse/convert into command status * @return ACTIVE, DEPRECATED, INACTIVE if match * @throws GeniePreconditionException on invalid value */ public static CommandStatus parse(final String value) throws GeniePreconditionException { if (StringUtils.isNotBlank(value)) { for (final CommandStatus status : CommandStatus.values()) { if (value.equalsIgnoreCase(status.toString())) { return status; } } } throw new GeniePreconditionException( "Unacceptable command status. Must be one of {ACTIVE, DEPRECATED, INACTIVE}"); }
From source file:com.hbc.api.trade.order.validator.OrderValidator.java
/** * ???-,2-2,[3-3,...]FALSETradeException * @param orderBean/*from www .j a v a 2 s. c o m*/ */ public final static void validateChildSeat(OrderBean orderBean) { if (StringUtils.isNotBlank(orderBean.getChildSeat())) { for (String childSeatString : orderBean.getChildSeat().split(TradeConstant.SPLITER_COMMA)) { if (childSeatString != null && childSeatString.split(TradeConstant.SPLITER_LINE).length != 2) { log.error( "?? -,2-2,[3-3,...]" + orderBean.getChildSeat()); throw new TradeException(TradeReturnCodeEnum.ORDER_PARAM_FAILED, ""); } } } }
From source file:net.eledge.android.europeana.search.model.enums.DocType.java
public static DocType safeValueOf(String string) { if (StringUtils.isNotBlank(string)) { for (DocType t : values()) { if (t.toString().equalsIgnoreCase(string)) { return t; }//w ww . j av a 2s . c o m } } return null; }
From source file:com.netflix.genie.common.dto.ClusterStatus.java
/** * Parse cluster status./*from ww w .java 2s .com*/ * * @param value string to parse/convert into cluster status * @return UP, OUT_OF_SERVICE, TERMINATED if match * @throws GeniePreconditionException on invalid value */ public static ClusterStatus parse(final String value) throws GeniePreconditionException { if (StringUtils.isNotBlank(value)) { for (final ClusterStatus status : ClusterStatus.values()) { if (value.equalsIgnoreCase(status.toString())) { return status; } } } throw new GeniePreconditionException( "Unacceptable cluster status. Must be one of {UP, OUT_OF_SERVICE, TERMINATED}"); }
From source file:com.hybris.mobile.app.commerce.utils.HockeyAppUtils.java
/** * HockeyApp for new updates on the app//from w ww .ja va2 s .c o m * * @param context */ public static void checkForUpdates(Activity context) { if (StringUtils.isNotBlank(CommerceApplication.getConfiguration().getHockeyAppIdentifier())) { UpdateManager.register(context, CommerceApplication.getConfiguration().getHockeyAppIdentifier()); } }
From source file:com.netflix.genie.common.dto.ApplicationStatus.java
/** * Parse config status.//from w w w. j av a 2s. c o m * * @param value string to parse/convert into config status * @return ACTIVE, DEPRECATED, INACTIVE if match * @throws GeniePreconditionException on invalid value */ public static ApplicationStatus parse(final String value) throws GeniePreconditionException { if (StringUtils.isNotBlank(value)) { for (final ApplicationStatus status : ApplicationStatus.values()) { if (value.equalsIgnoreCase(status.toString())) { return status; } } } throw new GeniePreconditionException( "Unacceptable application status. Must be one of {ACTIVE, DEPRECATED, INACTIVE}"); }
From source file:cop.raml.utils.javadoc.JavaDocUtils.java
public static String getDocComment(Element element, ProcessingEnvironment processingEnv) { String str = element != null ? processingEnv.getElementUtils().getDocComment(element) : null; return StringUtils.isNotBlank(str) ? str.trim() : null; }
From source file:com.wavemaker.commons.json.JSONUtils.java
public static String prettifyJSON(String data) throws IOException { if (StringUtils.isNotBlank(data)) { JsonNode tree = objectMapper.readTree(data); return objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(tree); }//from ww w . jav a 2s. c o m return data; }
From source file:com.cnten.platform.util.FileUtil.java
public static String getThumbnailFilePath(String filePath) { StringBuffer thumbnailFilePath = new StringBuffer(); if (StringUtils.isNotBlank(filePath)) { int lastIndex = filePath.lastIndexOf('.'); lastIndex = lastIndex > 0 ? lastIndex : 0; thumbnailFilePath.append(filePath.substring(0, lastIndex)); thumbnailFilePath.append("_thumbnail"); thumbnailFilePath.append('.'); thumbnailFilePath.append(getExtensionName(filePath)); }/*from ww w .ja va2 s . c om*/ return thumbnailFilePath.toString(); }
From source file:com.quatico.base.aem.test.api.AemMatchers.java
public static Matcher<Node> nodeExistsAt(String path) { return new TypeSafeMatcher<Node>() { @Override/* w w w.j av a 2s. c o m*/ protected boolean matchesSafely(Node actual) { try { return actual != null && StringUtils.isNotBlank(actual.getProperty(ResourceProperty.PRIMARY_TYPE).getString()) && path.equals(actual.getPath()); } catch (RepositoryException ex) { return false; } } @Override public void describeTo(Description description) { description.appendText( MessageFormat.format("Node with non-null jcr:primaryType at {0} should exist.", path)); } }; }