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.autonomy.nonaci.indexing.impl.DreInitialCommand.java
@Override public String getQueryString() { // Get the query string comprising of all the other parameters... final String queryString = super.getQueryString(); try {// w ww. ja v a 2s. c o m return (StringUtils.isBlank(path)) ? queryString : StringUtils.isBlank(queryString) ? urlCodec.encode(path, "UTF-8") : urlCodec.encode(path, "UTF-8") + '&' + queryString; } catch (final UnsupportedEncodingException uee) { throw new IndexingException(uee); } }
From source file:com.github.yongchristophertang.database.guice.provider.JdbcTemplateFactory.java
/** * Transfer an annotation to a T object. * * @param anno Sql annotation//from w ww. j a va 2 s . c o m */ @Override protected JdbcTemplate createClient(SqlDB anno) { if (StringUtils.isBlank(anno.url()) || StringUtils.isBlank(anno.userName()) || StringUtils.isBlank(anno.password())) { throw new IllegalArgumentException("Not all necessary configuration are specified."); } HikariDataSource ds = new HikariDataSource(); ds.setJdbcUrl(anno.url()); ds.setUsername(anno.userName()); ds.setPassword(anno.password()); return new JdbcTemplate(ds); }
From source file:com.wavemaker.commons.json.deserializer.WMDateDeSerializer.java
public static Date getDate(String value) { if (StringUtils.isBlank(value)) { return null; }/*from ww w . j a v a 2 s.co m*/ try { Date parsedDate = new SimpleDateFormat(DEFAULT_DATE_TIME_FORMAT).parse(value); return new Timestamp(parsedDate.getTime()); } catch (ParseException e) { logger.trace("{} is not in the expected date time format {}", value, DEFAULT_DATE_TIME_FORMAT); } try { Date parsedDate = new SimpleDateFormat(DEFAULT_DATE_FORMAT).parse(value); return new java.sql.Date(parsedDate.getTime()); } catch (ParseException e) { logger.trace("{} is not in the expected date format {}", value, DEFAULT_DATE_FORMAT); } try { Date parsedDate = new SimpleDateFormat(DEFAULT_TIME_FORMAT).parse(value); return new Time(parsedDate.getTime()); } catch (ParseException e) { logger.trace("{} is not in the expected time format {}", value, DEFAULT_TIME_FORMAT); } throw new WMRuntimeException("Failed to parse the string " + value + "as java.util.Date"); }
From source file:io.cloudslang.content.httpclient.build.URIBuilder.java
public URIBuilder setQueryParamsAreURLEncoded(String queryParamsAreURLEncoded) { if (!StringUtils.isBlank(queryParamsAreURLEncoded)) { this.queryParamsAreURLEncoded = queryParamsAreURLEncoded; }/* w w w.j av a 2s.co m*/ return this; }
From source file:ch.cyberduck.core.serializer.LocalDictionary.java
public <T> Local deserialize(T serialized) { final Deserializer dict = deserializer.create(serialized); final String path = dict.stringForKey("Path"); if (StringUtils.isBlank(path)) { return null; }/*from w w w. ja va 2s . c om*/ final Local file = LocalFactory.get(path); final String data = dict.stringForKey("Bookmark"); if (StringUtils.isNotBlank(data)) { file.setBookmark(data); } return file; }
From source file:com.trenako.web.editors.BrandPropertyEditor.java
@Override public void setAsText(String text) throws IllegalArgumentException { if (allowEmpty && StringUtils.isBlank(text)) { setValue(null);//from ww w. j a va2s . co m return; } if (!ObjectId.isValid(text)) { throw new IllegalArgumentException(text + " is not a valid ObjecId"); } ObjectId id = new ObjectId(text); setValue(new Brand(id)); }
From source file:com.netflix.spinnaker.kork.dynomite.LocalRedisDynomiteClient.java
public LocalRedisDynomiteClient(int port) { String rack = StringUtils.isBlank(System.getenv("EC2_REGION")) ? "local" : System.getenv("EC2_REGION"); HostSupplier localHostSupplier = new HostSupplier() { final Host hostSupplierHost = new Host("localhost", rack, Host.Status.Up); @Override// w w w . j av a 2 s . c o m public List<Host> getHosts() { return Collections.singletonList(hostSupplierHost); } }; TokenMapSupplier tokenMapSupplier = new TokenMapSupplier() { final Host tokenHost = new Host("localhost", port, rack, Host.Status.Up); final HostToken localHostToken = new HostToken(100000L, tokenHost); @Override public List<HostToken> getTokens(Set<Host> activeHosts) { return Collections.singletonList(localHostToken); } @Override public HostToken getTokenForHost(Host host, Set<Host> activeHosts) { return localHostToken; } }; this.dynoJedisClient = new DynoJedisClient.Builder().withDynomiteClusterName("local") .withApplicationName(String.valueOf(port)).withHostSupplier(localHostSupplier) .withCPConfig(new ConnectionPoolConfigurationImpl(String.valueOf(port)) .setCompressionStrategy(ConnectionPoolConfiguration.CompressionStrategy.NONE) .setLocalRack(rack).withHashtag("{}").withHostSupplier(localHostSupplier) .withTokenSupplier(tokenMapSupplier)) .build(); }
From source file:com.ottogroup.bi.asap.component.strategy.YieldMessageWaitStrategy.java
/** * @see com.ottogroup.bi.asap.component.Component#init(java.util.Properties) */// ww w . j av a 2 s. c o m public void init(Properties settings) throws RequiredInputMissingException { this.id = settings.getProperty(CFG_COMPONENT_ID); if (StringUtils.isBlank(this.id)) throw new RequiredInputMissingException("Missing required input for '" + CFG_COMPONENT_ID + "'"); }
From source file:jongo.jdbc.OrderParam.java
public OrderParam(String col) { if (StringUtils.isBlank(col)) throw new IllegalArgumentException("Invalid column parameter"); if (ASC.equalsIgnoreCase(col) || DESC.equalsIgnoreCase(col)) throw new IllegalArgumentException("Invalid column parameter"); this.column = StringUtils.deleteWhitespace(col); this.direction = ASC; }
From source file:com.cognifide.aet.cleaner.processors.filters.DBKeyProjectCompanyPredicate.java
private boolean projectMatches(DBKey dbKey) { return StringUtils.isBlank(projectFilter) || dbKey.getProject().equals(projectFilter); }