com.fasterxml.jackson.databind.jsonFormatVisitors.JsonArrayFormatVisitor Java Examples
The following examples show how to use
com.fasterxml.jackson.databind.jsonFormatVisitors.JsonArrayFormatVisitor.
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 |
@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: MultimapSerializer.java From jackson-datatypes-collections with Apache License 2.0 | 6 votes |
@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 #3
Source File: FieldDocumentationVisitorWrapper.java From spring-auto-restdocs with Apache License 2.0 | 6 votes |
@Override public JsonArrayFormatVisitor expectArrayFormat(JavaType arrayType) throws JsonMappingException { JavaType contentType = arrayType.getContentType(); addFieldIfPresent(determineArrayOfType(contentType)); if (contentType != null && shouldExpand() && (topLevelPath() || !wasVisited(contentType))) { log.trace("({}) {} expanding array", path, toString(contentType)); // do not add this type to visited now, it will be done in expectObjectFormat for // content type of this array return new FieldDocumentationArrayVisitor(provider, context, path, typeRegistry, typeFactory, skipAccessor); } else { log.trace("({}) {} NOT expanding array", path, "<unknown>"); return new JsonArrayFormatVisitor.Base(); } }
Example #4
Source File: ByteBufferSerializer.java From lams with GNU General Public License v2.0 | 5 votes |
@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 #5
Source File: ByteArraySerializer.java From lams with GNU General Public License v2.0 | 5 votes |
@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 #6
Source File: HppcContainerSerializers.java From jackson-datatypes-collections with Apache License 2.0 | 5 votes |
@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 |
@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 |
@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 #9
Source File: HppcContainerSerializers.java From jackson-datatypes-collections with Apache License 2.0 | 5 votes |
@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 #10
Source File: HppcContainerSerializers.java From jackson-datatypes-collections with Apache License 2.0 | 5 votes |
@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 #11
Source File: HppcContainerSerializers.java From jackson-datatypes-collections with Apache License 2.0 | 5 votes |
@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 #12
Source File: HppcContainerSerializers.java From jackson-datatypes-collections with Apache License 2.0 | 5 votes |
@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 #13
Source File: DataHandlerJsonSerializer.java From jackson-modules-base with Apache License 2.0 | 5 votes |
@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 #14
Source File: StaticListSerializerBase.java From lams with GNU General Public License v2.0 | 4 votes |
protected abstract void acceptContentVisitor(JsonArrayFormatVisitor visitor) throws JsonMappingException;
Example #15
Source File: IndexedStringListSerializer.java From lams with GNU General Public License v2.0 | 4 votes |
@Override protected void acceptContentVisitor(JsonArrayFormatVisitor visitor) throws JsonMappingException { visitor.itemsFormat(JsonFormatTypes.STRING); }
Example #16
Source File: StringCollectionSerializer.java From lams with GNU General Public License v2.0 | 4 votes |
@Override protected void acceptContentVisitor(JsonArrayFormatVisitor visitor) throws JsonMappingException { visitor.itemsFormat(JsonFormatTypes.STRING); }