當前位置: 首頁>>代碼示例>>Java>>正文


Java Strings.isEmpty方法代碼示例

本文整理匯總了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));
}
 
開發者ID:johtani,項目名稱:elasticsearch-ingest-csv,代碼行數:21,代碼來源:CsvProcessor.java

示例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");
    }
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:22,代碼來源:IngestDocument.java

示例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;
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:8,代碼來源:SliceBuilder.java

示例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;
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:8,代碼來源:CollapseBuilder.java

示例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();
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:18,代碼來源:FileSystemUtils.java

示例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;
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:17,代碼來源:PrefixQueryBuilder.java

示例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;
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:12,代碼來源:RangeQueryBuilder.java

示例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;
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:14,代碼來源:CommonTermsQueryBuilder.java

示例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;
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:11,代碼來源:MatchPhraseQueryBuilder.java

示例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;
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:17,代碼來源:FieldMaskingSpanQueryBuilder.java

示例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;
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:18,代碼來源:TermsQueryBuilder.java

示例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);
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:10,代碼來源:WrapperQueryBuilder.java

示例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);
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:20,代碼來源:BaseTermQueryBuilder.java

示例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;
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:11,代碼來源:GeoDistanceQueryBuilder.java

示例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);
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:17,代碼來源:FuzzyQueryBuilder.java


注:本文中的org.elasticsearch.common.Strings.isEmpty方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。