Example usage for com.fasterxml.jackson.core JsonParser getCurrentToken

List of usage examples for com.fasterxml.jackson.core JsonParser getCurrentToken

Introduction

In this page you can find the example usage for com.fasterxml.jackson.core JsonParser getCurrentToken.

Prototype

public abstract JsonToken getCurrentToken();

Source Link

Document

Accessor to find which token parser currently points to, if any; null will be returned if none.

Usage

From source file:com.taveloper.http.test.StreamParseUtil.java

public static JsonToken getCurrentToken(JsonParser parser) {
    return parser.getCurrentToken();
}

From source file:com.microsoft.azure.storage.core.JsonUtilities.java

/***
 * Reserved for internal use. Asserts that the current token of the parser is a field name.
 * /*from  ww  w . j  a  va 2s . c om*/
 * @param parser
 *            The {@link JsonParser} whose current token to check.
 */
public static void assertIsFieldNameJsonToken(final JsonParser parser) throws JsonParseException {
    if (!(parser.getCurrentToken() == JsonToken.FIELD_NAME)) {
        throw new JsonParseException(SR.EXPECTED_A_FIELD_NAME, parser.getCurrentLocation());
    }
}

From source file:com.microsoft.azure.storage.core.JsonUtilities.java

/***
 * Reserved for internal use. Asserts that the current token of the parser is the start of an object.
 * /*from  ww w.  j  a  v a  2s  . c o  m*/
 * @param parser
 *            The {@link JsonParser} whose current token to check.
 */
public static void assertIsStartObjectJsonToken(final JsonParser parser) throws JsonParseException {
    if (!(parser.getCurrentToken() == JsonToken.START_OBJECT)) {
        throw new JsonParseException(SR.EXPECTED_START_OBJECT, parser.getCurrentLocation());
    }
}

From source file:com.microsoft.azure.storage.core.JsonUtilities.java

/***
 * Reserved for internal use. Asserts that the current token of the parser is the end of an object.
 * // ww  w .j a  va  2 s .  co  m
 * @param parser
 *            The {@link JsonParser} whose current token to check.
 */
public static void assertIsEndObjectJsonToken(final JsonParser parser) throws JsonParseException {
    if (!(parser.getCurrentToken() == JsonToken.END_OBJECT)) {
        throw new JsonParseException(SR.EXPECTED_END_OBJECT, parser.getCurrentLocation());
    }
}

From source file:com.microsoft.azure.storage.core.JsonUtilities.java

/***
 * Reserved for internal use. Asserts that the token type of the parser is the start of an array.
 * /*from www .  j  ava 2 s .c  o  m*/
 * @param parser
 *            The {@link JsonParser} whose current token to check.
 */
public static void assertIsStartArrayJsonToken(final JsonParser parser) throws JsonParseException {
    if (!(parser.getCurrentToken() == JsonToken.START_ARRAY)) {
        throw new JsonParseException(SR.EXPECTED_START_ARRAY, parser.getCurrentLocation());
    }
}

From source file:com.microsoft.azure.storage.core.JsonUtilities.java

/***
 * Reserved for internal use. Asserts that the token type of the parser is the end of an array.
 * /*w  ww  .j ava 2 s.co m*/
 * @param parser
 *            The {@link JsonParser} whose current token to check.
 */
public static void assertIsEndArrayJsonToken(final JsonParser parser) throws JsonParseException {
    if (!(parser.getCurrentToken() == JsonToken.END_ARRAY)) {
        throw new JsonParseException(SR.EXPECTED_END_ARRAY, parser.getCurrentLocation());
    }
}

From source file:com.microsoft.azure.storage.table.ODataUtilities.java

/***
 * Reserved for internal use. Asserts that the current token of the parser is a field name.
 * /*  ww  w.  ja  va2  s  .  c  om*/
 * @param parser
 *            The {@link JsonParser} whose current token to check.
 */
protected static void assertIsFieldNameJsonToken(final JsonParser parser) throws JsonParseException {
    if (!(parser.getCurrentToken() == JsonToken.FIELD_NAME)) {
        throw new JsonParseException(SR.EXPECTED_A_FIELD_NAME, parser.getCurrentLocation());
    }
}

From source file:com.microsoft.azure.storage.table.ODataUtilities.java

/***
 * Reserved for internal use. Asserts that the current token of the parser is the start of an object.
 * /*  www  .  ja  v a 2 s .com*/
 * @param parser
 *            The {@link JsonParser} whose current token to check.
 */
protected static void assertIsStartObjectJsonToken(final JsonParser parser) throws JsonParseException {
    if (!(parser.getCurrentToken() == JsonToken.START_OBJECT)) {
        throw new JsonParseException(SR.EXPECTED_START_OBJECT, parser.getCurrentLocation());
    }
}

From source file:com.microsoft.azure.storage.table.ODataUtilities.java

/***
 * Reserved for internal use. Asserts that the current token of the parser is the end of an object.
 * /*from  w w w .  ja  va2 s .c  o  m*/
 * @param parser
 *            The {@link JsonParser} whose current token to check.
 */
protected static void assertIsEndObjectJsonToken(final JsonParser parser) throws JsonParseException {
    if (!(parser.getCurrentToken() == JsonToken.END_OBJECT)) {
        throw new JsonParseException(SR.EXPECTED_END_OBJECT, parser.getCurrentLocation());
    }
}

From source file:com.microsoft.azure.storage.table.ODataUtilities.java

/***
 * Reserved for internal use. Asserts that the token type of the parser is the start of an array.
 * //from  w w w . jav a2s.  c o m
 * @param parser
 *            The {@link JsonParser} whose current token to check.
 */
protected static void assertIsStartArrayJsonToken(final JsonParser parser) throws JsonParseException {
    if (!(parser.getCurrentToken() == JsonToken.START_ARRAY)) {
        throw new JsonParseException(SR.EXPECTED_START_ARRAY, parser.getCurrentLocation());
    }
}