java.lang.Object
org.elasticsearch.xcontent.NamedXContentRegistry
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic classAn entry in the NamedXContentRegistry containing the name of the object and the parser that can parse it.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final NamedXContentRegistryThe emptyNamedXContentRegistryfor use when you are sure that you aren't going to callXContentParser.namedObject(Class, String, Object).
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionbooleanhasParser(Class<?> categoryClass, String name, RestApiVersion apiVersion) Returnstrueif this registry is able toparsethe referenced object, false otherwise.lookupParser(Class<T> categoryClass, String name, XContentParser parser) <T,C> T parseNamedObject(Class<T> categoryClass, String name, XContentParser parser, C context) Parse a named object, throwing an exception if the parser isn't found.
- 
Field Details- 
EMPTYThe emptyNamedXContentRegistryfor use when you are sure that you aren't going to callXContentParser.namedObject(Class, String, Object). Be *very* careful with this singleton because a parser using it will fail every call to XContentParser.namedObject(Class, String, Object). Every non-test usage really should be checked thoroughly and marked with a comment about how it was checked. That way anyone that sees code that uses it knows that it is potentially dangerous.
 
- 
- 
Constructor Details- 
NamedXContentRegistry
 
- 
- 
Method Details- 
parseNamedObjectpublic <T,C> T parseNamedObject(Class<T> categoryClass, String name, XContentParser parser, C context) throws IOException Parse a named object, throwing an exception if the parser isn't found. Throws anNamedObjectNotFoundExceptionif thecategoryClassisn't registered because this is almost always a bug. Throws anNamedObjectNotFoundExceptionif thecategoryClassis registered but thenameisn't.- Throws:
- NamedObjectNotFoundException- if the categoryClass or name is not registered
- IOException
 
- 
hasParserReturnstrueif this registry is able toparsethe referenced object, false otherwise. Note: This method does not throw exceptions, even if theRestApiVersionorcategoryClassare unknown.
- 
lookupParserpublic <T> NamedXContentRegistry.Entry lookupParser(Class<T> categoryClass, String name, XContentParser parser) 
 
-