Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.fasterxml.jackson.datatype.joda.deser;
 
 
 
public class PeriodDeserializer
    extends JodaDeserializerBase<Period>
    public PeriodDeserializer() { super(Period.class); }
   
    @Override
            throws IOExceptionJsonProcessingException
    {
        // TODO: perhaps support array of numbers...
        //if (jp.isExpectedStartArrayToken()) { ]
        switch (jp.getCurrentToken()) {
        case // assume it's millisecond count
            return new Period(jp.getLongValue());            
        case :
            return new Period(jp.getText());
        }
        throw ctxt.wrongTokenException(jp."expected JSON Number or String");
   }
New to GrepCode? Check out our FAQ X