Package org.elasticsearch.index.mapper
Class TestDocumentParserContext
java.lang.Object
org.elasticsearch.index.mapper.DocumentParserContext
org.elasticsearch.index.mapper.TestDocumentParserContext
public class TestDocumentParserContext
extends org.elasticsearch.index.mapper.DocumentParserContext
Simplified version of
DocumentParserContext
to be used in tests.
Every non final method throws UnsupportedOperationException
and can be implemented as needed.
doc()
and path()
are defined and final, as their behaviour is standard and they
are both needed in almost every situation.
The methods defined final in DocumentParserContext
depend on the provided constructor arguments.-
Constructor Summary
ConstructorsConstructorDescriptionThe shortest and easiest way to create a context, to be used when none of the constructor arguments are needed.TestDocumentParserContext(org.elasticsearch.index.mapper.MappingLookup mappingLookup, org.elasticsearch.index.IndexSettings indexSettings, org.elasticsearch.index.analysis.IndexAnalyzers indexAnalyzers, Function<org.elasticsearch.common.time.DateFormatter,org.elasticsearch.index.mapper.MappingParserContext> parserContextFunction, org.elasticsearch.index.mapper.SourceToParse source)
More verbose way to create a context, to be used when one or more constructor arguments are needed as final methods that depend on them are called while executing tests. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addDoc(org.elasticsearch.index.mapper.LuceneDocument doc)
org.elasticsearch.index.mapper.LuceneDocument
doc()
Iterable<org.elasticsearch.index.mapper.LuceneDocument>
org.elasticsearch.xcontent.XContentParser
parser()
org.elasticsearch.index.mapper.ContentPath
path()
org.elasticsearch.index.mapper.LuceneDocument
rootDoc()
Methods inherited from class org.elasticsearch.index.mapper.DocumentParserContext
addDynamicMapper, addDynamicRuntimeField, addIgnoredField, addToFieldNames, createCopyToContext, createMultiFieldContext, createNestedContext, dynamicTemplateParserContext, findDynamicTemplate, getDynamicMappers, getDynamicRuntimeFields, getIgnoredFields, getMetadataMapper, getObjectMapper, indexAnalyzers, indexSettings, isShadowed, isWithinCopyTo, isWithinMultiFields, mappingLookup, overridePath, root, seqID, seqID, sourceToParse, switchDoc, switchParser, version, version
-
Constructor Details
-
TestDocumentParserContext
public TestDocumentParserContext()The shortest and easiest way to create a context, to be used when none of the constructor arguments are needed. Use with caution as it can causeNullPointerException
s down the line. -
TestDocumentParserContext
public TestDocumentParserContext(org.elasticsearch.index.mapper.MappingLookup mappingLookup, org.elasticsearch.index.IndexSettings indexSettings, org.elasticsearch.index.analysis.IndexAnalyzers indexAnalyzers, Function<org.elasticsearch.common.time.DateFormatter,org.elasticsearch.index.mapper.MappingParserContext> parserContextFunction, org.elasticsearch.index.mapper.SourceToParse source)More verbose way to create a context, to be used when one or more constructor arguments are needed as final methods that depend on them are called while executing tests.
-
-
Method Details
-
doc
public final org.elasticsearch.index.mapper.LuceneDocument doc()- Specified by:
doc
in classorg.elasticsearch.index.mapper.DocumentParserContext
-
path
public final org.elasticsearch.index.mapper.ContentPath path()- Specified by:
path
in classorg.elasticsearch.index.mapper.DocumentParserContext
-
nonRootDocuments
- Specified by:
nonRootDocuments
in classorg.elasticsearch.index.mapper.DocumentParserContext
-
parser
public org.elasticsearch.xcontent.XContentParser parser()- Specified by:
parser
in classorg.elasticsearch.index.mapper.DocumentParserContext
-
rootDoc
public org.elasticsearch.index.mapper.LuceneDocument rootDoc()- Specified by:
rootDoc
in classorg.elasticsearch.index.mapper.DocumentParserContext
-
addDoc
protected void addDoc(org.elasticsearch.index.mapper.LuceneDocument doc)- Specified by:
addDoc
in classorg.elasticsearch.index.mapper.DocumentParserContext
-