com.fasterxml.jackson.databind.deser.std.StdScalarDeserializer Java Examples
The following examples show how to use
com.fasterxml.jackson.databind.deser.std.StdScalarDeserializer.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AutoTrimConfiguration.java From dew with Apache License 2.0 | 5 votes |
/** * Instantiates a new Auto trim configuration. */ public AutoTrimConfiguration() { addDeserializer(String.class, new StdScalarDeserializer<String>(String.class) { @Override public String deserialize(JsonParser jsonParser, DeserializationContext ctx) throws IOException { String value = jsonParser.getValueAsString(); if (StringUtils.isEmpty(value)) { return value; } return value.trim(); } }); }
Example #2
Source File: DurationCustomizationFactory.java From caravan with Apache License 2.0 | 5 votes |
@Override public JsonDeserializer<Duration> createDeserializer() { return new StdScalarDeserializer<Duration>(Duration.class) { @Override public Duration deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { // TODO p.getText(); return TimeRelatedConverter.dataTypeFactory.newDuration(1); } }; }
Example #3
Source File: ShortCustomizationFactory.java From caravan with Apache License 2.0 | 5 votes |
@Override public JsonDeserializer<Short> createDeserializer() { return new StdScalarDeserializer<Short>(Short.class) { @Override public Short deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { ProtobufParser pp = (ProtobufParser) p; return (short) pp.getIntValue(); } }; }
Example #4
Source File: ByteCustomizationFactory.java From caravan with Apache License 2.0 | 5 votes |
@Override public JsonDeserializer<Byte> createDeserializer() { return new StdScalarDeserializer<Byte>(Byte.class) { @Override public Byte deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { ProtobufParser pp = (ProtobufParser) p; return (byte) pp.getIntValue(); } }; }
Example #5
Source File: BooleanCustomizationFactory.java From caravan with Apache License 2.0 | 5 votes |
@Override public JsonDeserializer<Boolean> createDeserializer() { return new StdScalarDeserializer<Boolean>(Boolean.class) { @Override public Boolean deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { ProtobufParser pp = (ProtobufParser) p; return pp.getIntValue() == 1 ? Boolean.TRUE : Boolean.FALSE; } }; }
Example #6
Source File: CharacterCustomizationFactory.java From caravan with Apache License 2.0 | 5 votes |
@SuppressWarnings("serial") @Override public JsonDeserializer<Character> createDeserializer() { return new StdScalarDeserializer<Character>(Character.class) { @Override public Character deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { ProtobufParser pp = (ProtobufParser) p; return (char) pp.getIntValue(); } }; }
Example #7
Source File: ObjectMapperBuilder.java From elasticactors with Apache License 2.0 | 5 votes |
private boolean hasNoArgConstructor(Class<? extends StdScalarDeserializer> customDeserializer) { try { customDeserializer.getConstructor(); } catch(NoSuchMethodException e) { return false; } return true; }