public JsonSerializer<?> modifyCollectionSerializer( SerializationConfig config, CollectionType valueType, BeanDescription beanDesc, JsonSerializer<?> serializer) { Class<?> klass = beanDesc.getBeanClass(); if (ClassUtil.isExtendedBy(klass, Set.class)) { return new SetSerializer(serializer); } else { return new ListSerializer(serializer); } }
@Override public JsonSerializer<?> modifySerializer( SerializationConfig config, BeanDescription beanDesc, JsonSerializer<?> serializer) { Class<?> klass = beanDesc.getBeanClass(); if (klass == Boolean.class) { return new BooleanSerializer(serializer); } else if (klass == Integer.class) { return new IntegerSerializer(serializer); } else if (klass == Long.class) { return new LongSerializer(serializer); } else if (klass == Float.class) { return new FloatSerializer(serializer); } else if (klass == Double.class) { return new DoubleSerializer(serializer); } else if (klass == BigDecimal.class) { return new BigDecimalSerializer(serializer); } else if (ClassUtil.isExtendedBy(klass, Date.class)) { return new DateSerializer(serializer); } return serializer; }