|
4 | 4 | import com.fasterxml.jackson.databind.JavaType;
|
5 | 5 | import com.fasterxml.jackson.databind.JsonSerializer;
|
6 | 6 | import com.fasterxml.jackson.databind.SerializationConfig;
|
| 7 | +import com.fasterxml.jackson.databind.jsontype.TypeSerializer; |
7 | 8 | import com.fasterxml.jackson.databind.ser.Serializers;
|
| 9 | +import com.fasterxml.jackson.databind.ser.std.CollectionSerializer; |
| 10 | +import com.fasterxml.jackson.databind.type.CollectionLikeType; |
8 | 11 | import com.fasterxml.jackson.datatype.eclipsecollections.ser.BooleanIterableSerializer;
|
9 | 12 | import com.fasterxml.jackson.datatype.eclipsecollections.ser.ByteIterableSerializer;
|
10 | 13 | import com.fasterxml.jackson.datatype.eclipsecollections.ser.CharIterableSerializer;
|
|
28 | 31 | import org.eclipse.collections.api.LongIterable;
|
29 | 32 | import org.eclipse.collections.api.PrimitiveIterable;
|
30 | 33 | import org.eclipse.collections.api.ShortIterable;
|
| 34 | +import org.eclipse.collections.api.collection.ImmutableCollection; |
31 | 35 | import org.eclipse.collections.api.map.MapIterable;
|
32 | 36 | import org.eclipse.collections.api.map.primitive.ByteObjectMap;
|
33 | 37 | import org.eclipse.collections.api.map.primitive.CharObjectMap;
|
|
47 | 51 | import org.eclipse.collections.api.map.primitive.ShortObjectMap;
|
48 | 52 |
|
49 | 53 | public final class EclipseCollectionsSerializers extends Serializers.Base {
|
| 54 | + @Override |
| 55 | + public JsonSerializer<?> findCollectionLikeSerializer( |
| 56 | + SerializationConfig config, |
| 57 | + CollectionLikeType type, |
| 58 | + BeanDescription beanDesc, |
| 59 | + TypeSerializer elementTypeSerializer, |
| 60 | + JsonSerializer<Object> elementValueSerializer |
| 61 | + ) { |
| 62 | + if (ImmutableCollection.class.isAssignableFrom(type.getRawClass())) { |
| 63 | + return new CollectionSerializer( |
| 64 | + type.getContentType(), |
| 65 | + false, |
| 66 | + elementTypeSerializer, |
| 67 | + elementValueSerializer |
| 68 | + ); |
| 69 | + } |
| 70 | + return null; |
| 71 | + } |
| 72 | + |
50 | 73 | @Override
|
51 | 74 | public JsonSerializer<?> findSerializer(
|
52 | 75 | SerializationConfig config, JavaType type, BeanDescription beanDesc
|
|
0 commit comments