Java Code Examples for org.apache.commons.lang3.StringUtils.containsWhitespace()

The following are Jave code examples for showing how to use containsWhitespace() of the org.apache.commons.lang3.StringUtils class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: para-search-elasticsearch   File:   View Source Code Vote up 5 votes
private static boolean createIndexWithoutAlias(String name, int shards, int replicas) {
	if (StringUtils.isBlank(name) || StringUtils.containsWhitespace(name) || existsIndex(name)) {
		return false;
	if (shards <= 0) {
		shards = Config.getConfigInt("es.shards", 5);
	if (replicas < 0) {
		replicas = Config.getConfigInt("es.replicas", 0);
	try {
		Settings.Builder settings = Settings.builder();
		settings.put("number_of_shards", Integer.toString(shards));
		settings.put("number_of_replicas", Integer.toString(replicas));
		settings.put("auto_expand_replicas", Config.getConfigParam("es.auto_expand_replicas", "0-1"));
		settings.put("analysis.analyzer.default.type", "standard");
				"arabic", "armenian", "basque", "brazilian", "bulgarian", "catalan",
				"czech", "danish", "dutch", "english", "finnish", "french", "galician",
				"german", "greek", "hindi", "hungarian", "indonesian", "italian",
				"norwegian", "persian", "portuguese", "romanian", "russian", "spanish",
				"swedish", "turkish");

		CreateIndexRequestBuilder create = getClient().admin().indices().prepareCreate(name).

		// default system mapping (all the rest are dynamic)
		create.addMapping("paraobject", getDefaultMapping(), XContentType.JSON);
		create.execute().actionGet();"Created a new index '{}' with {} shards, {} replicas.", name, shards, replicas);
	} catch (Exception e) {
		logger.warn(null, e);
		return false;
	return true;
Example 2
Project: OneClient   File:   View Source Code Vote up 4 votes
public static String parseLetters(String name) {
	if (StringUtils.containsWhitespace(name)) {
		return WordUtils.initials(name);
	return name.substring(0, Math.min(7, name.length()));