Example usage for com.fasterxml.jackson.core JsonToken toString

List of usage examples for com.fasterxml.jackson.core JsonToken toString

Introduction

In this page you can find the example usage for com.fasterxml.jackson.core JsonToken toString.

Prototype

public String toString() 

Source Link

Document

Returns a string representation of the object.

Usage

From source file:com.netflix.hollow.jsonadapter.HollowJsonAdapter.java

private int parseSubType(JsonParser parser, JsonToken currentToken, String subType) throws IOException {
    HollowSchema subTypeSchema = hollowSchemas.get(subType);
    switch (subTypeSchema.getSchemaType()) {
    case OBJECT:/*w  w w  .  j  av  a  2 s .  c  o  m*/
        if (currentToken != JsonToken.START_OBJECT)
            throw new IOException("Expecting to parse a " + subType + ", which is a "
                    + subTypeSchema.getSchemaType() + ", expected JsonToken.START_OBJECT but instead found a "
                    + currentToken.toString());

        return addObject(parser, subType);

    case LIST:
    case SET:
        if (currentToken != JsonToken.START_ARRAY)
            throw new IOException("Expecting to parse a " + subType + ", which is a "
                    + subTypeSchema.getSchemaType() + ", expected JsonToken.START_ARRAY but instead found a "
                    + currentToken.toString());

        return addSubArray(parser, subType, getWriteRecord(subType));

    case MAP:
        switch (currentToken) {
        case START_ARRAY:
            return addStructuredMap(parser, subType, (HollowMapWriteRecord) getWriteRecord(subType));
        case START_OBJECT:
            return addUnstructuredMap(parser, subType, (HollowMapWriteRecord) getWriteRecord(subType));
        default:
            throw new IOException(
                    "Expecting to parse a " + subType + ", which is a " + subTypeSchema.getSchemaType()
                            + ", expected JsonToken.START_ARRAY or JsonToken.START_OBJECT but instead found a "
                            + currentToken.toString());
        }
    }
    throw new IOException();
}