本文整理汇总了Java中org.elasticsearch.common.Strings.isEmpty方法的典型用法代码示例。如果您正苦于以下问题:Java Strings.isEmpty方法的具体用法?Java Strings.isEmpty怎么用?Java Strings.isEmpty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.elasticsearch.common.Strings
的用法示例。
在下文中一共展示了Strings.isEmpty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: create
import org.elasticsearch.common.Strings; //导入方法依赖的package包/类
@Override
public CsvProcessor create(Map<String, Processor.Factory> factories, String tag, Map<String, Object> config)
throws Exception {
String field = readStringProperty(TYPE, tag, config, "field");
List<String> columns = readList(TYPE, tag, config, "columns");
// FIXME should test duplicate name
if (columns.size() == 0) {
throw new IllegalArgumentException("columns is missing");
}
String quoteChar = readStringProperty(TYPE, tag, config, "quote_char", "\"");
if (Strings.isEmpty(quoteChar) || quoteChar.length() != 1) {
throw new IllegalArgumentException("quote_char must be a character, like \" or \'");
}
String separator = readStringProperty(TYPE, tag, config, "separator", ",");
if (Strings.isEmpty(separator) || separator.length() != 1) {
throw new IllegalArgumentException("separator must be a character, like , or TAB");
}
return new CsvProcessor(tag, field, columns, quoteChar.charAt(0), separator.charAt(0));
}
示例2: FieldPath
import org.elasticsearch.common.Strings; //导入方法依赖的package包/类
private FieldPath(String path) {
if (Strings.isEmpty(path)) {
throw new IllegalArgumentException("path cannot be null nor empty");
}
String newPath;
if (path.startsWith(INGEST_KEY_PREFIX)) {
initialContext = ingestMetadata;
newPath = path.substring(INGEST_KEY_PREFIX.length(), path.length());
} else {
initialContext = sourceAndMetadata;
if (path.startsWith(SOURCE_PREFIX)) {
newPath = path.substring(SOURCE_PREFIX.length(), path.length());
} else {
newPath = path;
}
}
this.pathElements = newPath.split("\\.");
if (pathElements.length == 1 && pathElements[0].isEmpty()) {
throw new IllegalArgumentException("path [" + path + "] is not valid");
}
}
示例3: setField
import org.elasticsearch.common.Strings; //导入方法依赖的package包/类
private SliceBuilder setField(String field) {
if (Strings.isEmpty(field)) {
throw new IllegalArgumentException("field name is null or empty");
}
this.field = field;
return this;
}
示例4: setField
import org.elasticsearch.common.Strings; //导入方法依赖的package包/类
private CollapseBuilder setField(String field) {
if (Strings.isEmpty(field)) {
throw new IllegalArgumentException("field name is null or empty");
}
this.field = field;
return this;
}
示例5: openFileURLStream
import org.elasticsearch.common.Strings; //导入方法依赖的package包/类
/**
* Returns an InputStream the given url if the url has a protocol of 'file' or 'jar', no host, and no port.
*/
@SuppressForbidden(reason = "Will only open url streams for local files")
public static InputStream openFileURLStream(URL url) throws IOException {
String protocol = url.getProtocol();
if ("file".equals(protocol) == false && "jar".equals(protocol) == false) {
throw new IllegalArgumentException("Invalid protocol [" + protocol + "], must be [file] or [jar]");
}
if (Strings.isEmpty(url.getHost()) == false) {
throw new IllegalArgumentException("URL cannot have host. Found: [" + url.getHost() + ']');
}
if (url.getPort() != -1) {
throw new IllegalArgumentException("URL cannot have port. Found: [" + url.getPort() + ']');
}
return url.openStream();
}
示例6: PrefixQueryBuilder
import org.elasticsearch.common.Strings; //导入方法依赖的package包/类
/**
* A Query that matches documents containing terms with a specified prefix.
*
* @param fieldName The name of the field
* @param value The prefix query
*/
public PrefixQueryBuilder(String fieldName, String value) {
if (Strings.isEmpty(fieldName)) {
throw new IllegalArgumentException("field name is null or empty");
}
if (value == null) {
throw new IllegalArgumentException("value cannot be null");
}
this.fieldName = fieldName;
this.value = value;
}
示例7: RangeQueryBuilder
import org.elasticsearch.common.Strings; //导入方法依赖的package包/类
/**
* A Query that matches documents within an range of terms.
*
* @param fieldName The field name
*/
public RangeQueryBuilder(String fieldName) {
if (Strings.isEmpty(fieldName)) {
throw new IllegalArgumentException("field name is null or empty");
}
this.fieldName = fieldName;
}
示例8: CommonTermsQueryBuilder
import org.elasticsearch.common.Strings; //导入方法依赖的package包/类
/**
* Constructs a new common terms query.
*/
public CommonTermsQueryBuilder(String fieldName, Object text) {
if (Strings.isEmpty(fieldName)) {
throw new IllegalArgumentException("field name is null or empty");
}
if (text == null) {
throw new IllegalArgumentException("text cannot be null");
}
this.fieldName = fieldName;
this.text = text;
}
示例9: MatchPhraseQueryBuilder
import org.elasticsearch.common.Strings; //导入方法依赖的package包/类
public MatchPhraseQueryBuilder(String fieldName, Object value) {
if (Strings.isEmpty(fieldName)) {
throw new IllegalArgumentException("[" + NAME + "] requires fieldName");
}
if (value == null) {
throw new IllegalArgumentException("[" + NAME + "] requires query value");
}
this.fieldName = fieldName;
this.value = value;
}
示例10: FieldMaskingSpanQueryBuilder
import org.elasticsearch.common.Strings; //导入方法依赖的package包/类
/**
* Constructs a new {@link FieldMaskingSpanQueryBuilder} given an inner {@link SpanQueryBuilder} for
* a given field
* @param queryBuilder inner {@link SpanQueryBuilder}
* @param fieldName the field name
*/
public FieldMaskingSpanQueryBuilder(SpanQueryBuilder queryBuilder, String fieldName) {
if (Strings.isEmpty(fieldName)) {
throw new IllegalArgumentException("field name is null or empty");
}
if (queryBuilder == null) {
throw new IllegalArgumentException("inner clause [query] cannot be null.");
}
this.queryBuilder = queryBuilder;
this.fieldName = fieldName;
}
示例11: TermsQueryBuilder
import org.elasticsearch.common.Strings; //导入方法依赖的package包/类
/**
* constructor used internally for serialization of both value / termslookup variants
*/
TermsQueryBuilder(String fieldName, List<Object> values, TermsLookup termsLookup) {
if (Strings.isEmpty(fieldName)) {
throw new IllegalArgumentException("field name cannot be null.");
}
if (values == null && termsLookup == null) {
throw new IllegalArgumentException("No value or termsLookup specified for terms query");
}
if (values != null && termsLookup != null) {
throw new IllegalArgumentException("Both values and termsLookup specified for terms query");
}
this.fieldName = fieldName;
this.values = values == null ? null : convert(values);
this.termsLookup = termsLookup;
}
示例12: WrapperQueryBuilder
import org.elasticsearch.common.Strings; //导入方法依赖的package包/类
/**
* Creates a query builder given a query provided as a string
*/
public WrapperQueryBuilder(String source) {
if (Strings.isEmpty(source)) {
throw new IllegalArgumentException("query source string cannot be null or empty");
}
this.source = source.getBytes(StandardCharsets.UTF_8);
}
示例13: BaseTermQueryBuilder
import org.elasticsearch.common.Strings; //导入方法依赖的package包/类
/**
* Constructs a new base term query.
* In case value is assigned to a string, we internally convert it to a {@link BytesRef}
* because in {@link TermQueryBuilder} and {@link SpanTermQueryBuilder} string values are parsed to {@link BytesRef}
* and we want internal representation of query to be equal regardless of whether it was created from XContent or via Java API.
*
* @param fieldName The name of the field
* @param value The value of the term
*/
public BaseTermQueryBuilder(String fieldName, Object value) {
if (Strings.isEmpty(fieldName)) {
throw new IllegalArgumentException("field name is null or empty");
}
if (value == null) {
throw new IllegalArgumentException("value cannot be null");
}
this.fieldName = fieldName;
this.value = convertToBytesRefIfString(value);
}
示例14: GeoDistanceQueryBuilder
import org.elasticsearch.common.Strings; //导入方法依赖的package包/类
/**
* Construct new GeoDistanceQueryBuilder.
* @param fieldName name of indexed geo field to operate distance computation on.
* */
public GeoDistanceQueryBuilder(String fieldName) {
if (Strings.isEmpty(fieldName)) {
throw new IllegalArgumentException("fieldName must not be null or empty");
}
this.fieldName = fieldName;
}
示例15: FuzzyQueryBuilder
import org.elasticsearch.common.Strings; //导入方法依赖的package包/类
/**
* Constructs a new fuzzy query.
*
* @param fieldName The name of the field
* @param value The value of the term
*/
public FuzzyQueryBuilder(String fieldName, Object value) {
if (Strings.isEmpty(fieldName)) {
throw new IllegalArgumentException("field name cannot be null or empty");
}
if (value == null) {
throw new IllegalArgumentException("query value cannot be null");
}
this.fieldName = fieldName;
this.value = convertToBytesRefIfString(value);
}