Search in sources :

Example 1 with FileContainer

use of com.github.dreamhead.moco.parser.model.FileContainer in project moco by dreamhead.

the class FileContainerDeserializer method deserialize.

@Override
public FileContainer deserialize(final JsonParser jp, final DeserializationContext ctxt) throws IOException {
    JsonToken currentToken = jp.getCurrentToken();
    if (currentToken == JsonToken.VALUE_STRING) {
        return asFileContainer(helper.text(jp));
    }
    if (currentToken == JsonToken.START_OBJECT) {
        jp.nextToken();
        String target = jp.getText().trim();
        if (isForFileContainer(target)) {
            return toFileContainer(jp);
        }
        return asFileContainer(helper.textContainer(jp, ctxt));
    }
    return (FileContainer) ctxt.handleUnexpectedToken(FileContainer.class, jp);
}
Also used : JsonToken(com.fasterxml.jackson.core.JsonToken) FileContainer.asFileContainer(com.github.dreamhead.moco.parser.model.FileContainer.asFileContainer) FileContainer(com.github.dreamhead.moco.parser.model.FileContainer) FileContainer.aFileContainer(com.github.dreamhead.moco.parser.model.FileContainer.aFileContainer)

Aggregations

JsonToken (com.fasterxml.jackson.core.JsonToken)1 FileContainer (com.github.dreamhead.moco.parser.model.FileContainer)1 FileContainer.aFileContainer (com.github.dreamhead.moco.parser.model.FileContainer.aFileContainer)1 FileContainer.asFileContainer (com.github.dreamhead.moco.parser.model.FileContainer.asFileContainer)1