Java Code Examples for com.fasterxml.jackson.databind.jsonFormatVisitors.JsonArrayFormatVisitor#itemsFormat()

The following examples show how to use com.fasterxml.jackson.databind.jsonFormatVisitors.JsonArrayFormatVisitor#itemsFormat() . 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: ObjectArraySerializer.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
@Override
    public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint)
        throws JsonMappingException
    {
        JsonArrayFormatVisitor arrayVisitor = visitor.expectArrayFormat(typeHint);
        if (arrayVisitor != null) {
            JavaType contentType = _elementType;

            // [databind#1793]: Was getting `null` for `typeHint`. But why would we even use it...
/*
            TypeFactory tf = visitor.getProvider().getTypeFactory();
            contentType = tf.moreSpecificType(_elementType, typeHint.getContentType());
            if (contentType == null) {
                visitor.getProvider().reportBadDefinition(_elementType,
                        "Could not resolve type: "+_elementType);
            }
*/
            JsonSerializer<?> valueSer = _elementSerializer;
            if (valueSer == null) {
                valueSer = visitor.getProvider().findValueSerializer(contentType, _property);
            }
            arrayVisitor.itemsFormat(valueSer, contentType);
        }
    }
 
Example 2
Source File: ByteBufferSerializer.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override // since 2.9
public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint)
    throws JsonMappingException
{
    // 31-Mar-2017, tatu: Use same type as `ByteArraySerializer`: not optimal but has to do
    JsonArrayFormatVisitor v2 = visitor.expectArrayFormat(typeHint);
    if (v2 != null) {
        v2.itemsFormat(JsonFormatTypes.INTEGER);
    }
}
 
Example 3
Source File: ByteArraySerializer.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint)
    throws JsonMappingException
{
    // 14-Mar-2016, tatu: while logically (and within JVM) binary, gets encoded as Base64 String,
    // let's try to indicate it is array of Bytes... difficult, thanks to JSON Schema's
    // lackluster listing of types
    //
    // TODO: for 2.8, make work either as String/base64, or array of numbers,
    //   with a qualifier that can be used to determine it's byte[]
    JsonArrayFormatVisitor v2 = visitor.expectArrayFormat(typeHint);
    if (v2 != null) {
        v2.itemsFormat(JsonFormatTypes.INTEGER);
    }
}
 
Example 4
Source File: HppcContainerSerializers.java    From jackson-datatypes-collections with Apache License 2.0 5 votes vote down vote up
@Override
public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint)
        throws JsonMappingException
{
    if (visitor != null) {
        JsonArrayFormatVisitor v2 = visitor.expectArrayFormat(typeHint);
        if (v2 != null) {
            v2.itemsFormat(JsonFormatTypes.INTEGER);
        }
    }
}
 
Example 5
Source File: HppcContainerSerializers.java    From jackson-datatypes-collections with Apache License 2.0 5 votes vote down vote up
@Override
public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint)
        throws JsonMappingException
{
    if (visitor != null) {
        JsonArrayFormatVisitor v2 = visitor.expectArrayFormat(typeHint);
        if (v2 != null) {
            v2.itemsFormat(JsonFormatTypes.INTEGER);
        }
    }
}
 
Example 6
Source File: HppcContainerSerializers.java    From jackson-datatypes-collections with Apache License 2.0 5 votes vote down vote up
@Override
public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint)
        throws JsonMappingException
{
    if (visitor != null) {
        JsonArrayFormatVisitor v2 = visitor.expectArrayFormat(typeHint);
        if (v2 != null) {
            v2.itemsFormat(JsonFormatTypes.INTEGER);
        }
    }
}
 
Example 7
Source File: HppcContainerSerializers.java    From jackson-datatypes-collections with Apache License 2.0 5 votes vote down vote up
@Override
public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint)
        throws JsonMappingException
{
    if (visitor != null) {
        JsonArrayFormatVisitor v2 = visitor.expectArrayFormat(typeHint);
        if (v2 != null) {
            v2.itemsFormat(JsonFormatTypes.INTEGER);
        }
    }
}
 
Example 8
Source File: HppcContainerSerializers.java    From jackson-datatypes-collections with Apache License 2.0 5 votes vote down vote up
@Override
public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint)
    throws JsonMappingException
{
    if (visitor != null) {
        JsonArrayFormatVisitor v2 = visitor.expectArrayFormat(typeHint);
        if (v2 != null) {
            v2.itemsFormat(JsonFormatTypes.NUMBER);
        }
    }
}
 
Example 9
Source File: HppcContainerSerializers.java    From jackson-datatypes-collections with Apache License 2.0 5 votes vote down vote up
@Override
public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint)
    throws JsonMappingException
{
    if (visitor != null) {
        JsonArrayFormatVisitor v2 = visitor.expectArrayFormat(typeHint);
        if (v2 != null) {
            v2.itemsFormat(JsonFormatTypes.NUMBER);
        }
    }
}
 
Example 10
Source File: HppcContainerSerializers.java    From jackson-datatypes-collections with Apache License 2.0 5 votes vote down vote up
@Override
public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint)
        throws JsonMappingException
{
    if (visitor != null) {
        JsonArrayFormatVisitor v2 = visitor.expectArrayFormat(typeHint);
        if (v2 != null) {
            v2.itemsFormat(JsonFormatTypes.BOOLEAN);
        }
    }
}
 
Example 11
Source File: DataHandlerJsonSerializer.java    From jackson-modules-base with Apache License 2.0 5 votes vote down vote up
@Override
public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint)
    throws JsonMappingException
{
    if (visitor != null) {
        JsonArrayFormatVisitor v2 = visitor.expectArrayFormat(typeHint);
        if (v2 != null) {
            v2.itemsFormat(JsonFormatTypes.STRING);
        }
    }
}
 
Example 12
Source File: IndexedStringListSerializer.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected void acceptContentVisitor(JsonArrayFormatVisitor visitor) throws JsonMappingException {
    visitor.itemsFormat(JsonFormatTypes.STRING);
}
 
Example 13
Source File: StringCollectionSerializer.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected void acceptContentVisitor(JsonArrayFormatVisitor visitor) throws JsonMappingException
{
    visitor.itemsFormat(JsonFormatTypes.STRING);
}