Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.fasterxml.jackson.datatype.joda.deser;
 
 

Author(s):
jkolobok
    public IntervalDeserializer() {
        super(Interval.class);
    }
    @Override
    public Interval deserialize(JsonParser jsonParserDeserializationContext deserializationContextthrows IOExceptionJsonProcessingException {
        switch (jsonParser.getCurrentToken()) {
            case :
               String v = jsonParser.getText();
                int dashIndex = v.indexOf('-');
                long start = Long.valueOf(v.substring(0, dashIndex));
                long end = Long.valueOf(v.substring(dashIndex + 1));
                return new Interval(startend);
        }
        throw deserializationContext.mappingException("expected JSON String");
    }
New to GrepCode? Check out our FAQ X