class JsonXContentParser extends AbstractXContentParser {

    final JsonParser parser;

    public JsonXContentParser(NamedXContentRegistry xContentRegistry,
            DeprecationHandler deprecationHandler, JsonParser parser) {
        super(xContentRegistry, deprecationHandler);
        this.parser = parser;
    }

    @Override
    public XContentType contentType() {
        return XContentType.JSON;
    }

    @Override
    public Token nextToken() throws IOException {
        return convertToken(parser.nextToken());
    }

    @Override
    public void skipChildren() throws IOException {
        parser.skipChildren();
    }

    @Override
    public Token currentToken() {
        return convertToken(parser.getCurrentToken());
    }

    @Override
    public NumberType numberType() throws IOException {
        return convertNumberType(parser.getNumberType());
    }

    @Override
    public String currentName() throws IOException {
        return parser.getCurrentName();
    }

    @Override
    protected boolean doBooleanValue() throws IOException {
        return parser.getBooleanValue();
    }

    @Override
    public String text() throws IOException {
        if (currentToken().isValue()) {
            return parser.getText();
        }
        throw new IllegalStateException("Can't get text on a " + currentToken() + " at " + getTokenLocation());
    }

    @Override
    public CharBuffer charBuffer() throws IOException {
        return CharBuffer.wrap(parser.getTextCharacters(), parser.getTextOffset(), parser.getTextLength());
    }

    @Override
    public Object objectText() throws IOException {
        JsonToken currentToken = parser.getCurrentToken();
        if (currentToken == JsonToken.VALUE_STRING) {
            return text();
        } else if (currentToken == JsonToken.VALUE_NUMBER_INT || currentToken == JsonToken.VALUE_NUMBER_FLOAT) {
            return parser.getNumberValue();
        } else if (currentToken == JsonToken.VALUE_TRUE) {
            return Boolean.TRUE;
        } else if (currentToken == JsonToken.VALUE_FALSE) {
            return Boolean.FALSE;
        } else if (currentToken == JsonToken.VALUE_NULL) {
            return null;
        } else {
            return text();
        }
    }

    @Override
    public boolean hasTextCharacters() {
        return parser.hasTextCharacters();
    }

    @Override
    public char[] textCharacters() throws IOException {
        return parser.getTextCharacters();
    }

    @Override
    public int textLength() throws IOException {
        return parser.getTextLength();
    }

    @Override
    public int textOffset() throws IOException {
        return parser.getTextOffset();
    }

    @Override
    public Number numberValue() throws IOException {
        return parser.getNumberValue();
    }

    @Override
    public short doShortValue() throws IOException {
        return parser.getShortValue();
    }

    @Override
    public int doIntValue() throws IOException {
        return parser.getIntValue();
    }

    @Override
    public long doLongValue() throws IOException {
        return parser.getLongValue();
    }

    @Override
    public float doFloatValue() throws IOException {
        return parser.getFloatValue();
    }

    @Override
    public double doDoubleValue() throws IOException {
        return parser.getDoubleValue();
    }

    @Override
    public byte[] binaryValue() throws IOException {
        return parser.getBinaryValue();
    }

    @Override
    public XContentLocation getTokenLocation() {
        JsonLocation loc = parser.getTokenLocation();
        if (loc == null) {
            return null;
        }
        return new XContentLocation(loc.getLineNr(), loc.getColumnNr());
    }

    @Override
    public void close() {
        IOUtils.closeWhileHandlingException(parser);
    }

    private NumberType convertNumberType(JsonParser.NumberType numberType) {
        switch (numberType) {
            case INT:
                return NumberType.INT;
            case LONG:
                return NumberType.LONG;
            case FLOAT:
                return NumberType.FLOAT;
            case DOUBLE:
                return NumberType.DOUBLE;
            default:
                throw new IllegalStateException("No matching token for number_type [" + numberType + "]");
        }
    }

    private Token convertToken(JsonToken token) {<FILL_FUNCTION_BODY>}

    @Override
    public boolean isClosed() {
        return parser.isClosed();
    }
}

        if (token == null) {
            return null;
        }
        switch (token) {
            case FIELD_NAME:
                return Token.FIELD_NAME;
            case VALUE_FALSE:
            case VALUE_TRUE:
                return Token.VALUE_BOOLEAN;
            case VALUE_STRING:
                return Token.VALUE_STRING;
            case VALUE_NUMBER_INT:
            case VALUE_NUMBER_FLOAT:
                return Token.VALUE_NUMBER;
            case VALUE_NULL:
                return Token.VALUE_NULL;
            case START_OBJECT:
                return Token.START_OBJECT;
            case END_OBJECT:
                return Token.END_OBJECT;
            case START_ARRAY:
                return Token.START_ARRAY;
            case END_ARRAY:
                return Token.END_ARRAY;
            case VALUE_EMBEDDED_OBJECT:
                return Token.VALUE_EMBEDDED_OBJECT;
            default:
                throw new IllegalStateException("No matching token for json_token [" + token + "]");
        }
    
<methods>public void <init>(org.elasticsearch.common.xcontent.NamedXContentRegistry, org.elasticsearch.common.xcontent.DeprecationHandler) ,public boolean booleanValue() throws java.io.IOException,public double doubleValue() throws java.io.IOException,public double doubleValue(boolean) throws java.io.IOException,public float floatValue() throws java.io.IOException,public float floatValue(boolean) throws java.io.IOException,public org.elasticsearch.common.xcontent.DeprecationHandler getDeprecationHandler() ,public org.elasticsearch.common.xcontent.NamedXContentRegistry getXContentRegistry() ,public int intValue() throws java.io.IOException,public int intValue(boolean) throws java.io.IOException,public boolean isBooleanValue() throws java.io.IOException,public abstract boolean isClosed() ,public List<java.lang.Object> list() throws java.io.IOException,public List<java.lang.Object> listOrderedMap() throws java.io.IOException,public long longValue() throws java.io.IOException,public long longValue(boolean) throws java.io.IOException,public Map<java.lang.String,java.lang.Object> map() throws java.io.IOException,public Map<java.lang.String,T> map(Supplier<Map<java.lang.String,T>>, CheckedFunction<org.elasticsearch.common.xcontent.XContentParser,T,java.io.IOException>) throws java.io.IOException,public Map<java.lang.String,java.lang.Object> mapOrdered() throws java.io.IOException,public Map<java.lang.String,java.lang.String> mapStrings() throws java.io.IOException,public T namedObject(Class<T>, java.lang.String, java.lang.Object) throws java.io.IOException,public short shortValue(boolean) throws java.io.IOException,public final java.lang.String textOrNull() throws java.io.IOException<variables>public static final boolean DEFAULT_NUMBER_COERCE_POLICY,static final org.elasticsearch.common.xcontent.support.AbstractXContentParser.MapFactory ORDERED_MAP_FACTORY,static final org.elasticsearch.common.xcontent.support.AbstractXContentParser.MapStringsFactory ORDERED_MAP_STRINGS_FACTORY,static final org.elasticsearch.common.xcontent.support.AbstractXContentParser.MapFactory SIMPLE_MAP_FACTORY,static final org.elasticsearch.common.xcontent.support.AbstractXContentParser.MapStringsFactory SIMPLE_MAP_STRINGS_FACTORY,private final non-sealed org.elasticsearch.common.xcontent.DeprecationHandler deprecationHandler,private final non-sealed org.elasticsearch.common.xcontent.NamedXContentRegistry xContentRegistry