public class NamedXContentRegistry
extends java.lang.Object
Modifier and Type | Class | Description |
---|---|---|
static class |
NamedXContentRegistry.Entry |
An entry in the NamedXContentRegistry containing the name of the object and the parser that can parse it.
|
Modifier and Type | Field | Description |
---|---|---|
static NamedXContentRegistry |
EMPTY |
The empty
NamedXContentRegistry for use when you are sure that you aren't going to call
XContentParser.namedObject(Class, String, Object) . |
Constructor | Description |
---|---|
NamedXContentRegistry(java.util.List<NamedXContentRegistry.Entry> entries) |
Modifier and Type | Method | Description |
---|---|---|
<T,C> T |
parseNamedObject(java.lang.Class<T> categoryClass,
java.lang.String name,
XContentParser parser,
C context) |
Parse a named object, throwing an exception if the parser isn't found.
|
public static final NamedXContentRegistry EMPTY
NamedXContentRegistry
for use when you are sure that you aren't going to call
XContentParser.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.public NamedXContentRegistry(java.util.List<NamedXContentRegistry.Entry> entries)
public <T,C> T parseNamedObject(java.lang.Class<T> categoryClass, java.lang.String name, XContentParser parser, C context) throws java.io.IOException
NamedObjectNotFoundException
if the
categoryClass
isn't registered because this is almost always a bug. Throws an NamedObjectNotFoundException
if the
categoryClass
is registered but the name
isn't.NamedObjectNotFoundException
- if the categoryClass or name is not registeredjava.io.IOException