throws IOException, JsonProcessingException
{
// We'll accept either long (timestamp) or array:
switch (jp.getCurrentToken()) {
case VALUE_NUMBER_INT:
return new DateMidnight(jp.getLongValue());
case VALUE_STRING:
return parseLocal(jp).toDateMidnight();
case START_ARRAY:
jp.nextToken(); // VALUE_NUMBER_INT
int year = jp.getIntValue();
jp.nextToken(); // VALUE_NUMBER_INT
int month = jp.getIntValue();
jp.nextToken(); // VALUE_NUMBER_INT
int day = jp.getIntValue();
if (jp.nextToken() != JsonToken.END_ARRAY) {
ctxt.wrongTokenException(jp, JsonToken.START_ARRAY, "expected END_ARRAY after DateMidnight ints");
}
return new DateMidnight(year, month, day);
}
ctxt.wrongTokenException(jp, JsonToken.START_ARRAY, "expected JSON Array, Number or String");
return null;
}