com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitable Java Examples

The following examples show how to use com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitable. 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: MultimapSerializer.java    From jackson-datatypes-collections with Apache License 2.0 6 votes vote down vote up
@Override
public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint)
    throws JsonMappingException
{
    JsonMapFormatVisitor v2 = (visitor == null) ? null : visitor.expectMapFormat(typeHint);        
    if (v2 != null) {
        v2.keyFormat(_keySerializer, _type.getKeyType());
        JsonSerializer<?> valueSer = _valueSerializer;
        final JavaType vt = _type.getContentType();
        final SerializerProvider prov = visitor.getProvider();
        if (valueSer == null) {
            valueSer = _findAndAddDynamic(prov, vt);
        }
        final JsonSerializer<?> valueSer2 = valueSer;
        v2.valueFormat(new JsonFormatVisitable() {
            final JavaType arrayType = prov.getTypeFactory().constructArrayType(vt);
            @Override
            public void acceptJsonFormatVisitor(
                    JsonFormatVisitorWrapper v3, JavaType hint3)
                throws JsonMappingException
            {
                JsonArrayFormatVisitor v4 = v3.expectArrayFormat(arrayType);
                if (v4 != null) {
                    v4.itemsFormat(valueSer2, vt);
                }
            }
        }, vt);
    }
}
 
Example #2
Source File: FieldDocumentationArrayVisitor.java    From spring-auto-restdocs with Apache License 2.0 5 votes vote down vote up
@Override
public void itemsFormat(JsonFormatVisitable handler, JavaType elementType)
        throws JsonMappingException {
    String elementPath = path + "[]";
    JsonFormatVisitorWrapper visitor = new FieldDocumentationVisitorWrapper(getProvider(),
            context, elementPath, null, typeRegistry, typeFactory, skipAccessor);
    handler.acceptJsonFormatVisitor(visitor, elementType);
}