Class OSBadBooleanDeserializer

  • All Implemented Interfaces:
    com.fasterxml.jackson.databind.deser.NullValueProvider

    public class OSBadBooleanDeserializer
    extends com.fasterxml.jackson.databind.JsonDeserializer<Boolean>
    Openstack API V2 has a few Services which return a 'True' as a boolean value. Jackson typically will not realize that this is equivalent to 'true' and will throw an error. This Deserializer is a workaround to both problems
    Author:
    Jeremy Unruh
    • Nested Class Summary

      • Nested classes/interfaces inherited from class com.fasterxml.jackson.databind.JsonDeserializer

        com.fasterxml.jackson.databind.JsonDeserializer.None
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected boolean _parseBooleanFromNumber​(com.fasterxml.jackson.core.JsonParser jp, com.fasterxml.jackson.databind.DeserializationContext ctxt)
      _parse boolean from number.
      Boolean deserialize​(com.fasterxml.jackson.core.JsonParser jp, com.fasterxml.jackson.databind.DeserializationContext ctxt)
      • Methods inherited from class com.fasterxml.jackson.databind.JsonDeserializer

        deserialize, deserializeWithType, deserializeWithType, findBackReference, getAbsentValue, getDelegatee, getEmptyAccessPattern, getEmptyValue, getEmptyValue, getKnownPropertyNames, getNullAccessPattern, getNullValue, getNullValue, getObjectIdReader, handledType, isCachable, logicalType, replaceDelegatee, supportsUpdate, unwrappingDeserializer
    • Constructor Detail

      • OSBadBooleanDeserializer

        public OSBadBooleanDeserializer()
    • Method Detail

      • deserialize

        public Boolean deserialize​(com.fasterxml.jackson.core.JsonParser jp,
                                   com.fasterxml.jackson.databind.DeserializationContext ctxt)
                            throws IOException,
                                   com.fasterxml.jackson.core.JsonProcessingException
        Specified by:
        deserialize in class com.fasterxml.jackson.databind.JsonDeserializer<Boolean>
        Throws:
        IOException
        com.fasterxml.jackson.core.JsonProcessingException
      • _parseBooleanFromNumber

        protected final boolean _parseBooleanFromNumber​(com.fasterxml.jackson.core.JsonParser jp,
                                                        com.fasterxml.jackson.databind.DeserializationContext ctxt)
                                                 throws IOException,
                                                        com.fasterxml.jackson.core.JsonProcessingException
        _parse boolean from number.
        Parameters:
        jp - the jp
        ctxt - the ctxt
        Returns:
        true, if successful
        Throws:
        IOException - Signals that an I/O exception has occurred.
        com.fasterxml.jackson.core.JsonProcessingException - the json processing exception