Class AbstractXContentParser

java.lang.Object
org.elasticsearch.common.xcontent.support.AbstractXContentParser
All Implemented Interfaces:
java.io.Closeable, java.lang.AutoCloseable, XContentParser
Direct Known Subclasses:
JsonXContentParser, MapXContentParser

public abstract class AbstractXContentParser
extends java.lang.Object
implements XContentParser
  • Field Details

  • Constructor Details

  • Method Details

    • isBooleanValue

      public boolean isBooleanValue() throws java.io.IOException
      Specified by:
      isBooleanValue in interface XContentParser
      Returns:
      true iff the current value is either boolean (true or false) or one of "false", "true".
      Throws:
      java.io.IOException
    • booleanValue

      public boolean booleanValue() throws java.io.IOException
      Specified by:
      booleanValue in interface XContentParser
      Throws:
      java.io.IOException
    • doBooleanValue

      protected abstract boolean doBooleanValue() throws java.io.IOException
      Throws:
      java.io.IOException
    • shortValue

      public short shortValue() throws java.io.IOException
      Specified by:
      shortValue in interface XContentParser
      Throws:
      java.io.IOException
    • shortValue

      public short shortValue​(boolean coerce) throws java.io.IOException
      Specified by:
      shortValue in interface XContentParser
      Throws:
      java.io.IOException
    • doShortValue

      protected abstract short doShortValue() throws java.io.IOException
      Throws:
      java.io.IOException
    • intValue

      public int intValue() throws java.io.IOException
      Specified by:
      intValue in interface XContentParser
      Throws:
      java.io.IOException
    • intValue

      public int intValue​(boolean coerce) throws java.io.IOException
      Specified by:
      intValue in interface XContentParser
      Throws:
      java.io.IOException
    • doIntValue

      protected abstract int doIntValue() throws java.io.IOException
      Throws:
      java.io.IOException
    • longValue

      public long longValue() throws java.io.IOException
      Specified by:
      longValue in interface XContentParser
      Throws:
      java.io.IOException
    • longValue

      public long longValue​(boolean coerce) throws java.io.IOException
      Specified by:
      longValue in interface XContentParser
      Throws:
      java.io.IOException
    • doLongValue

      protected abstract long doLongValue() throws java.io.IOException
      Throws:
      java.io.IOException
    • floatValue

      public float floatValue() throws java.io.IOException
      Specified by:
      floatValue in interface XContentParser
      Throws:
      java.io.IOException
    • floatValue

      public float floatValue​(boolean coerce) throws java.io.IOException
      Specified by:
      floatValue in interface XContentParser
      Throws:
      java.io.IOException
    • doFloatValue

      protected abstract float doFloatValue() throws java.io.IOException
      Throws:
      java.io.IOException
    • doubleValue

      public double doubleValue() throws java.io.IOException
      Specified by:
      doubleValue in interface XContentParser
      Throws:
      java.io.IOException
    • doubleValue

      public double doubleValue​(boolean coerce) throws java.io.IOException
      Specified by:
      doubleValue in interface XContentParser
      Throws:
      java.io.IOException
    • doDoubleValue

      protected abstract double doDoubleValue() throws java.io.IOException
      Throws:
      java.io.IOException
    • textOrNull

      public final java.lang.String textOrNull() throws java.io.IOException
      Specified by:
      textOrNull in interface XContentParser
      Throws:
      java.io.IOException
    • charBufferOrNull

      public java.nio.CharBuffer charBufferOrNull() throws java.io.IOException
      Specified by:
      charBufferOrNull in interface XContentParser
      Throws:
      java.io.IOException
    • map

      public java.util.Map<java.lang.String,​java.lang.Object> map() throws java.io.IOException
      Specified by:
      map in interface XContentParser
      Throws:
      java.io.IOException
    • mapOrdered

      public java.util.Map<java.lang.String,​java.lang.Object> mapOrdered() throws java.io.IOException
      Specified by:
      mapOrdered in interface XContentParser
      Throws:
      java.io.IOException
    • mapStrings

      public java.util.Map<java.lang.String,​java.lang.String> mapStrings() throws java.io.IOException
      Specified by:
      mapStrings in interface XContentParser
      Throws:
      java.io.IOException
    • map

      public <T> java.util.Map<java.lang.String,​T> map​(java.util.function.Supplier<java.util.Map<java.lang.String,​T>> mapFactory, CheckedFunction<XContentParser,​T,​java.io.IOException> mapValueParser) throws java.io.IOException
      Description copied from interface: XContentParser
      Returns an instance of Map holding parsed map. Serves as a replacement for the "map", "mapOrdered" and "mapStrings" methods above.
      Specified by:
      map in interface XContentParser
      Type Parameters:
      T - map value type
      Parameters:
      mapFactory - factory for creating new Map objects
      mapValueParser - parser for parsing a single map value
      Returns:
      Map object
      Throws:
      java.io.IOException
    • list

      public java.util.List<java.lang.Object> list() throws java.io.IOException
      Specified by:
      list in interface XContentParser
      Throws:
      java.io.IOException
    • listOrderedMap

      public java.util.List<java.lang.Object> listOrderedMap() throws java.io.IOException
      Specified by:
      listOrderedMap in interface XContentParser
      Throws:
      java.io.IOException
    • readValue

      public static java.lang.Object readValue​(XContentParser parser, java.util.function.Supplier<java.util.Map<java.lang.String,​java.lang.Object>> mapFactory) throws java.io.IOException
      Throws:
      java.io.IOException
    • namedObject

      public <T> T namedObject​(java.lang.Class<T> categoryClass, java.lang.String name, java.lang.Object context) throws java.io.IOException
      Description copied from interface: XContentParser
      Parse an object by name.
      Specified by:
      namedObject in interface XContentParser
      Throws:
      java.io.IOException
    • getXContentRegistry

      public NamedXContentRegistry getXContentRegistry()
      Description copied from interface: XContentParser
      The registry used to resolve XContentParser.namedObject(Class, String, Object). Use this when building a sub-parser from this parser.
      Specified by:
      getXContentRegistry in interface XContentParser
    • isClosed

      public abstract boolean isClosed()
      Specified by:
      isClosed in interface XContentParser
    • getDeprecationHandler

      public DeprecationHandler getDeprecationHandler()
      Description copied from interface: XContentParser
      The callback to notify when parsing encounters a deprecated field.
      Specified by:
      getDeprecationHandler in interface XContentParser