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


Java Writeable类代码示例

本文整理汇总了Java中org.elasticsearch.common.io.stream.Writeable的典型用法代码示例。如果您正苦于以下问题:Java Writeable类的具体用法?Java Writeable怎么用?Java Writeable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: registerPipelineAggregation

import org.elasticsearch.common.io.stream.Writeable; //导入依赖的package包/类
private void registerPipelineAggregation(PipelineAggregationSpec spec) {
    if (false == transportClient) {
        namedXContents.add(new NamedXContentRegistry.Entry(BaseAggregationBuilder.class, spec.getName(), (p, c) -> {
            AggregatorFactories.AggParseContext context = (AggregatorFactories.AggParseContext) c;
            return spec.getParser().parse(context.name, context.queryParseContext);
        }));
    }
    namedWriteables.add(
            new NamedWriteableRegistry.Entry(PipelineAggregationBuilder.class, spec.getName().getPreferredName(), spec.getReader()));
    namedWriteables.add(
            new NamedWriteableRegistry.Entry(PipelineAggregator.class, spec.getName().getPreferredName(), spec.getAggregatorReader()));
    for (Map.Entry<String, Writeable.Reader<? extends InternalAggregation>> resultReader : spec.getResultReaders().entrySet()) {
        namedWriteables
                .add(new NamedWriteableRegistry.Entry(InternalAggregation.class, resultReader.getKey(), resultReader.getValue()));
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:17,代码来源:SearchModule.java

示例2: copyWriteable

import org.elasticsearch.common.io.stream.Writeable; //导入依赖的package包/类
/**
 * Create a copy of an original {@link Writeable} object by running it through a {@link BytesStreamOutput} and
 * reading it in again using a provided {@link Writeable.Reader}. The stream that is wrapped around the {@link StreamInput}
 * potentially need to use a {@link NamedWriteableRegistry}, so this needs to be provided too (although it can be
 * empty if the object that is streamed doesn't contain any {@link NamedWriteable} objects itself.
 */
public static <T extends Writeable> T copyWriteable(T original, NamedWriteableRegistry namedWritabelRegistry,
        Writeable.Reader<T> reader) throws IOException {
    try (BytesStreamOutput output = new BytesStreamOutput()) {
        original.writeTo(output);
        try (StreamInput in = new NamedWriteableAwareStreamInput(output.bytes().streamInput(), namedWritabelRegistry)) {
            return reader.read(in);
        }
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:16,代码来源:ESTestCase.java

示例3: copyInstance

import org.elasticsearch.common.io.stream.Writeable; //导入依赖的package包/类
/**
 * Simulates sending diffs over the wire
 */
public static <T extends Writeable> T copyInstance(T diffs, NamedWriteableRegistry namedWriteableRegistry,
                                                              Reader<T> reader) throws IOException {
    try (BytesStreamOutput output = new BytesStreamOutput()) {
        diffs.writeTo(output);
        try (StreamInput in = new NamedWriteableAwareStreamInput(output.bytes().streamInput(), namedWriteableRegistry)) {
            return reader.read(in);
        }
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:13,代码来源:DiffableTestUtils.java

示例4: assertSerialization

import org.elasticsearch.common.io.stream.Writeable; //导入依赖的package包/类
/**
 * Asserts that testInstance can be correctly.
 */
public static  <T extends Writeable> T assertSerialization(T testInstance, NamedWriteableRegistry namedWriteableRegistry,
                                                      Reader<T> reader) throws IOException {
    T deserializedInstance = copyInstance(testInstance, namedWriteableRegistry, reader);
    assertEquals(testInstance, deserializedInstance);
    assertEquals(testInstance.hashCode(), deserializedInstance.hashCode());
    assertNotSame(testInstance, deserializedInstance);
    return deserializedInstance;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:12,代码来源:DiffableTestUtils.java

示例5: AbstractRangeBuilder

import org.elasticsearch.common.io.stream.Writeable; //导入依赖的package包/类
/**
 * Read from a stream.
 */
protected AbstractRangeBuilder(StreamInput in, InternalRange.Factory<?, ?> rangeFactory, Writeable.Reader<R> rangeReader)
        throws IOException {
    super(in, rangeFactory.getValueSourceType(), rangeFactory.getValueType());
    this.rangeFactory = rangeFactory;
    ranges = in.readList(rangeReader);
    keyed = in.readBoolean();
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:11,代码来源:AbstractRangeBuilder.java

示例6: registerAggregation

import org.elasticsearch.common.io.stream.Writeable; //导入依赖的package包/类
private void registerAggregation(AggregationSpec spec) {
    if (false == transportClient) {
        namedXContents.add(new NamedXContentRegistry.Entry(BaseAggregationBuilder.class, spec.getName(), (p, c) -> {
            AggregatorFactories.AggParseContext context = (AggregatorFactories.AggParseContext) c;
            return spec.getParser().parse(context.name, context.queryParseContext);
        }));
    }
    namedWriteables.add(
            new NamedWriteableRegistry.Entry(AggregationBuilder.class, spec.getName().getPreferredName(), spec.getReader()));
    for (Map.Entry<String, Writeable.Reader<? extends InternalAggregation>> t : spec.getResultReaders().entrySet()) {
        String writeableName = t.getKey();
        Writeable.Reader<? extends InternalAggregation> internalReader = t.getValue();
        namedWriteables.add(new NamedWriteableRegistry.Entry(InternalAggregation.class, writeableName, internalReader));
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:16,代码来源:SearchModule.java

示例7: registerMetaDataCustom

import org.elasticsearch.common.io.stream.Writeable; //导入依赖的package包/类
private <T extends MetaData.Custom> void registerMetaDataCustom(String name, Writeable.Reader<T> reader,
                                                                Writeable.Reader<NamedDiff> diffReader,
                                                                CheckedFunction<XContentParser, T, IOException> parser) {
    namedWritables.add(new NamedWriteableRegistry.Entry(MetaData.Custom.class, name, reader));
    namedWritables.add(new NamedWriteableRegistry.Entry(NamedDiff.class, name, diffReader));
    namedXContents.add(new NamedXContentRegistry.Entry(MetaData.Custom.class, new ParseField(name), parser));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:8,代码来源:DedicatedClusterSnapshotRestoreIT.java

示例8: registerValueFormat

import org.elasticsearch.common.io.stream.Writeable; //导入依赖的package包/类
/**
 * Register a new ValueFormat.
 */
private void registerValueFormat(String name, Writeable.Reader<? extends DocValueFormat> reader) {
    namedWriteables.add(new NamedWriteableRegistry.Entry(DocValueFormat.class, name, reader));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:7,代码来源:SearchModule.java

示例9: ScoreFunctionSpec

import org.elasticsearch.common.io.stream.Writeable; //导入依赖的package包/类
public ScoreFunctionSpec(ParseField name, Writeable.Reader<T> reader, ScoreFunctionParser<T> parser) {
    super(name, reader, parser);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:4,代码来源:SearchPlugin.java

示例10: addResultReader

import org.elasticsearch.common.io.stream.Writeable; //导入依赖的package包/类
/**
 * Add a reader for the shard level results of the aggregation.
 */
public AggregationSpec addResultReader(String writeableName, Writeable.Reader<? extends InternalAggregation> resultReader) {
    resultReaders.put(writeableName, resultReader);
    return this;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:8,代码来源:SearchPlugin.java

示例11: getResultReaders

import org.elasticsearch.common.io.stream.Writeable; //导入依赖的package包/类
/**
 * Get the readers that must be registered for this aggregation's results.
 */
public Map<String, Writeable.Reader<? extends InternalAggregation>> getResultReaders() {
    return resultReaders;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:7,代码来源:SearchPlugin.java

示例12: getAggregatorReader

import org.elasticsearch.common.io.stream.Writeable; //导入依赖的package包/类
/**
 * The reader for the {@link PipelineAggregator}.
 */
public Writeable.Reader<? extends PipelineAggregator> getAggregatorReader() {
    return aggregatorReader;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:7,代码来源:SearchPlugin.java

示例13: SearchExtSpec

import org.elasticsearch.common.io.stream.Writeable; //导入依赖的package包/类
public SearchExtSpec(ParseField name, Writeable.Reader<? extends T> reader,
        CheckedFunction<XContentParser, T, IOException> parser) {
    super(name, reader, parser);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:5,代码来源:SearchPlugin.java

示例14: getReader

import org.elasticsearch.common.io.stream.Writeable; //导入依赖的package包/类
/**
 * The reader responsible for reading the behavior from the internode protocol.
 */
public Writeable.Reader<? extends W> getReader() {
    return reader;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:7,代码来源:SearchPlugin.java

示例15: instanceReader

import org.elasticsearch.common.io.stream.Writeable; //导入依赖的package包/类
@Override
protected Writeable.Reader<ScriptMetaData> instanceReader() {
    return ScriptMetaData::new;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:5,代码来源:ScriptMetaDataTests.java


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