DATACOUCH-159 - Improved performance of decoding of longs.
Original pull requests: #67. Cherry-pick ofe5bed8e, adapted with polishing from6fec488.
This commit is contained in:
@@ -23,7 +23,6 @@ import java.util.Map;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonFactory;
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonParseException;
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
@@ -39,6 +38,8 @@ import org.springframework.data.mapping.model.SimpleTypeHolder;
|
||||
* A Jackson JSON Translator that implements the {@link TranslationService} contract.
|
||||
*
|
||||
* @author Michael Nitschinger
|
||||
* @author Simon Baslé
|
||||
* @author Anastasiia Smirnova
|
||||
*/
|
||||
public class JacksonTranslationService implements TranslationService, InitializingBean {
|
||||
|
||||
@@ -221,18 +222,13 @@ public class JacksonTranslationService implements TranslationService, Initializi
|
||||
switch (token) {
|
||||
case VALUE_TRUE:
|
||||
case VALUE_FALSE:
|
||||
return parser.getValueAsBoolean();
|
||||
return parser.getBooleanValue();
|
||||
case VALUE_STRING:
|
||||
return parser.getValueAsString();
|
||||
case VALUE_NUMBER_INT:
|
||||
try {
|
||||
return parser.getValueAsInt();
|
||||
}
|
||||
catch (final JsonParseException e) {
|
||||
return parser.getValueAsLong();
|
||||
}
|
||||
return parser.getNumberValue();
|
||||
case VALUE_NUMBER_FLOAT:
|
||||
return parser.getValueAsDouble();
|
||||
return parser.getDoubleValue();
|
||||
case VALUE_NULL:
|
||||
return null;
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user