Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.fasterxml.jackson.databind.ser.std;
 
 
Serializer used for primitive boolean, as well as java.util.Boolean wrapper type.

Since this is one of "native" types, no type information is ever included on serialization (unlike for most scalar types as of 1.5)

public final class BooleanSerializer
{
    
Whether type serialized is primitive (boolean) or wrapper (java.lang.Boolean); if true, former, if false, latter.
    final boolean _forPrimitive;
    public BooleanSerializer(boolean forPrimitive)
    {
        super(Boolean.class);
         = forPrimitive;
    }
    @Override
    public void serialize(Boolean valueJsonGenerator jgenSerializerProvider provider)
        throws IOExceptionJsonGenerationException
    {
        jgen.writeBoolean(value.booleanValue());
    }
    @Override
    public JsonNode getSchema(SerializerProvider providerType typeHint)
    {
        return createSchemaNode("boolean", !);
    }
    
    @Override
    public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitorJavaType typeHint)
    {
        visitor.expectBooleanFormat(typeHint);
    }
New to GrepCode? Check out our FAQ X