当前位置: 首页>>代码示例>>Java>>正文


Java Strings.EMPTY_ARRAY属性代码示例

本文整理汇总了Java中org.elasticsearch.common.Strings.EMPTY_ARRAY属性的典型用法代码示例。如果您正苦于以下问题:Java Strings.EMPTY_ARRAY属性的具体用法?Java Strings.EMPTY_ARRAY怎么用?Java Strings.EMPTY_ARRAY使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.elasticsearch.common.Strings的用法示例。


在下文中一共展示了Strings.EMPTY_ARRAY属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onRefreshSettings

@Override
public void onRefreshSettings(Settings settings) {
    String[] awarenessAttributes = settings.getAsArray(CLUSTER_ROUTING_ALLOCATION_AWARENESS_ATTRIBUTES,
            AwarenessAllocationDecider.this.settings.getAsArray(CLUSTER_ROUTING_ALLOCATION_AWARENESS_ATTRIBUTES));
    if ("".equals(settings.get(CLUSTER_ROUTING_ALLOCATION_AWARENESS_ATTRIBUTES, null))) {
        awarenessAttributes = Strings.EMPTY_ARRAY; // the empty string resets this
    }
    if (awarenessAttributes != null && !Arrays.equals(AwarenessAllocationDecider.this.awarenessAttributes, awarenessAttributes)) {
        logger.info("updating [cluster.routing.allocation.awareness.attributes] from [{}] to [{}]", AwarenessAllocationDecider.this.awarenessAttributes, awarenessAttributes);
        AwarenessAllocationDecider.this.awarenessAttributes = awarenessAttributes;
    }
    Map<String, String[]> forcedAwarenessAttributes = new HashMap<>();
    Map<String, Settings> forceGroups = settings.getGroups(CLUSTER_ROUTING_ALLOCATION_AWARENESS_FORCE_GROUP);
    if (forceGroups.isEmpty()) {
        // check initial values (from config file)
        forceGroups = AwarenessAllocationDecider.this.settings.getGroups(CLUSTER_ROUTING_ALLOCATION_AWARENESS_FORCE_GROUP);
    }
    if (!forceGroups.isEmpty()) {
        for (Map.Entry<String, Settings> entry : forceGroups.entrySet()) {
            String[] aValues = entry.getValue().getAsArray("values");
            if (aValues.length > 0) {
                forcedAwarenessAttributes.put(entry.getKey(), aValues);
            }
        }
    }
    AwarenessAllocationDecider.this.forcedAwarenessAttributes = forcedAwarenessAttributes;
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:27,代码来源:AwarenessAllocationDecider.java

示例2: Id

public Id(String path) {
    this.path = path;
    if (path == null) {
        pathElements = Strings.EMPTY_ARRAY;
    } else {
        pathElements = Strings.delimitedListToStringArray(path, ".");
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:8,代码来源:MappingMetaData.java

示例3: paramAsStringArrayOrEmptyIfAll

public String[] paramAsStringArrayOrEmptyIfAll(String key) {
    String[] params = paramAsStringArray(key, Strings.EMPTY_ARRAY);
    if (Strings.isAllOrWildcard(params)) {
        return Strings.EMPTY_ARRAY;
    }
    return params;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:7,代码来源:RestRequest.java

示例4: CharFilteredText

public CharFilteredText(String name, String[] texts) {
    this.name = name;
    if (texts != null) {
        this.texts = texts;
    } else {
        this.texts = Strings.EMPTY_ARRAY;
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:8,代码来源:DetailAnalyzeResponse.java

示例5: readStringArray

public String[] readStringArray() throws IOException {
    int size = readVInt();
    if (size == 0) {
        return Strings.EMPTY_ARRAY;
    }
    String[] ret = new String[size];
    for (int i = 0; i < size; i++) {
        ret[i] = readString();
    }
    return ret;
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:11,代码来源:StreamInput.java

示例6: prepareDeleteByQuery

private static Engine.DeleteByQuery prepareDeleteByQuery(IndexQueryParserService queryParserService, MapperService mapperService, IndexAliasesService indexAliasesService, IndexCache indexCache, BytesReference source, @Nullable String[] filteringAliases, Engine.Operation.Origin origin, String... types) {
    long startTime = System.nanoTime();
    if (types == null) {
        types = Strings.EMPTY_ARRAY;
    }
    Query query;
    try {
        query = queryParserService.parseQuery(source).query();
    } catch (QueryParsingException ex) {
        // for BWC we try to parse directly the query since pre 1.0.0.Beta2 we didn't require a top level query field
        if (queryParserService.getIndexCreatedVersion().onOrBefore(Version.V_1_0_0_Beta2)) {
            try {
                XContentParser parser = XContentHelper.createParser(source);
                ParsedQuery parse = queryParserService.parse(parser);
                query = parse.query();
            } catch (Throwable t) {
                ex.addSuppressed(t);
                throw ex;
            }
        } else {
            throw ex;
        }
    }
    Query searchFilter = mapperService.searchFilter(types);
    if (searchFilter != null) {
        query = Queries.filtered(query, searchFilter);
    }

    Query aliasFilter = indexAliasesService.aliasFilter(filteringAliases);
    BitSetProducer parentFilter = mapperService.hasNested() ? indexCache.bitsetFilterCache().getBitSetProducer(Queries.newNonNestedFilter()) : null;
    return new Engine.DeleteByQuery(query, source, filteringAliases, aliasFilter, parentFilter, origin, startTime, types);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:32,代码来源:TranslogRecoveryPerformer.java

示例7: getCurrentTypes

protected static String[] getCurrentTypes() {
    return currentTypes == null ? Strings.EMPTY_ARRAY : currentTypes;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:3,代码来源:AbstractQueryTestCase.java

示例8: DeleteByQuery

public DeleteByQuery(BytesReference source, String[] filteringAliases, String... types) {
    this.source = source;
    this.types = types == null ? Strings.EMPTY_ARRAY : types;
    this.filteringAliases = filteringAliases;
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:5,代码来源:Translog.java

示例9: splitScrollIds

public static String[] splitScrollIds(String scrollIds) {
    if (scrollIds == null) {
        return Strings.EMPTY_ARRAY;
    }
    return Strings.splitStringByCommaToArray(scrollIds);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:6,代码来源:RestClearScrollAction.java

示例10: fromXContent

public static FetchSourceContext fromXContent(XContentParser parser) throws IOException {
    XContentParser.Token token = parser.currentToken();
    boolean fetchSource = true;
    String[] includes = Strings.EMPTY_ARRAY;
    String[] excludes = Strings.EMPTY_ARRAY;
    if (token == XContentParser.Token.VALUE_BOOLEAN) {
        fetchSource = parser.booleanValue();
    } else if (token == XContentParser.Token.VALUE_STRING) {
        includes = new String[]{parser.text()};
    } else if (token == XContentParser.Token.START_ARRAY) {
        ArrayList<String> list = new ArrayList<>();
        while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) {
            list.add(parser.text());
        }
        includes = list.toArray(new String[list.size()]);
    } else if (token == XContentParser.Token.START_OBJECT) {
        String currentFieldName = null;
        while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
            if (token == XContentParser.Token.FIELD_NAME) {
                currentFieldName = parser.currentName();
            } else if (token == XContentParser.Token.START_ARRAY) {
                if (INCLUDES_FIELD.match(currentFieldName)) {
                    List<String> includesList = new ArrayList<>();
                    while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) {
                        if (token == XContentParser.Token.VALUE_STRING) {
                            includesList.add(parser.text());
                        } else {
                            throw new ParsingException(parser.getTokenLocation(), "Unknown key for a " + token
                                    + " in [" + currentFieldName + "].", parser.getTokenLocation());
                        }
                    }
                    includes = includesList.toArray(new String[includesList.size()]);
                } else if (EXCLUDES_FIELD.match(currentFieldName)) {
                    List<String> excludesList = new ArrayList<>();
                    while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) {
                        if (token == XContentParser.Token.VALUE_STRING) {
                            excludesList.add(parser.text());
                        } else {
                            throw new ParsingException(parser.getTokenLocation(), "Unknown key for a " + token
                                    + " in [" + currentFieldName + "].", parser.getTokenLocation());
                        }
                    }
                    excludes = excludesList.toArray(new String[excludesList.size()]);
                } else {
                    throw new ParsingException(parser.getTokenLocation(), "Unknown key for a " + token
                            + " in [" + currentFieldName + "].", parser.getTokenLocation());
                }
            } else if (token == XContentParser.Token.VALUE_STRING) {
                if (INCLUDES_FIELD.match(currentFieldName)) {
                    includes = new String[] {parser.text()};
                } else if (EXCLUDES_FIELD.match(currentFieldName)) {
                    excludes = new String[] {parser.text()};
                } else {
                    throw new ParsingException(parser.getTokenLocation(), "Unknown key for a " + token
                        + " in [" + currentFieldName + "].", parser.getTokenLocation());
                }
            } else {
                throw new ParsingException(parser.getTokenLocation(), "Unknown key for a " + token + " in [" + currentFieldName + "].",
                        parser.getTokenLocation());
            }
        }
    } else {
        throw new ParsingException(parser.getTokenLocation(), "Expected one of [" + XContentParser.Token.VALUE_BOOLEAN + ", "
                + XContentParser.Token.START_OBJECT + "] but found [" + token + "]", parser.getTokenLocation());
    }
    return new FetchSourceContext(fetchSource, includes, excludes);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:67,代码来源:FetchSourceContext.java

示例11: GetPipelineRequest

GetPipelineRequest() {
    this.ids = Strings.EMPTY_ARRAY;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:3,代码来源:GetPipelineRequest.java

示例12: TypesExistsRequestBuilder

/**
 * @param indices What indices to check for types
 */
public TypesExistsRequestBuilder(ElasticsearchClient client, TypesExistsAction action, String... indices) {
    super(client, action, new TypesExistsRequest(indices, Strings.EMPTY_ARRAY));
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:6,代码来源:TypesExistsRequestBuilder.java

示例13: RecoveryRequest

/**
 * Constructs a request for recovery information for all shards
 */
public RecoveryRequest() {
    this(Strings.EMPTY_ARRAY);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:6,代码来源:RecoveryRequest.java

示例14: FetchSourceContext

public FetchSourceContext(String include, String exclude) {
    this(true,
            include == null ? Strings.EMPTY_ARRAY : new String[]{include},
            exclude == null ? Strings.EMPTY_ARRAY : new String[]{exclude},
            false);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:6,代码来源:FetchSourceContext.java

示例15: IndicesSegmentsRequest

public IndicesSegmentsRequest() {
    this(Strings.EMPTY_ARRAY);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:3,代码来源:IndicesSegmentsRequest.java


注:本文中的org.elasticsearch.common.Strings.EMPTY_ARRAY属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。