Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.fasterxml.jackson.datatype.joda.deser;
 
 
 
    public DateMidnightDeserializer() { super(DateMidnight.class); }
    @Override
        throws IOExceptionJsonProcessingException
    {
        // We'll accept either long (timestamp) or array:
        if (jp.isExpectedStartArrayToken()) {
            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() != .) {
                throw ctxt.wrongTokenException(jp."after DateMidnight ints");
            }
            return new DateMidnight(yearmonthday);
        }
        switch (jp.getCurrentToken()) {
        case :
            return new DateMidnight(jp.getLongValue());            
        case :
            DateTime local = parseLocal(jp);
            if (local == null) {
                return null;
            }
            return local.toDateMidnight();
        }
        throw ctxt.wrongTokenException(jp."expected JSON Array, Number or String");
    }
New to GrepCode? Check out our FAQ X