• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

wistefan / tmforum-api / #155

10 Jul 2025 11:38AM UTC coverage: 29.525%. First build
#155

push

web-flow
Merge 7e090be2d into a23e3db6a

389 of 5758 branches covered (6.76%)

Branch coverage included in aggregate %.

37 of 69 new or added lines in 23 files covered. (53.62%)

2627 of 4457 relevant lines covered (58.94%)

0.59 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/common/src/main/java/org/fiware/tmforum/common/mapping/ObjectMapperEventListener.java
1
package org.fiware.tmforum.common.mapping;
2

3
import com.fasterxml.jackson.annotation.JsonInclude;
4
import com.fasterxml.jackson.databind.BeanDescription;
5
import com.fasterxml.jackson.databind.DeserializationConfig;
6
import com.fasterxml.jackson.databind.JsonDeserializer;
7
import com.fasterxml.jackson.databind.ObjectMapper;
8
import com.fasterxml.jackson.databind.deser.BeanDeserializerModifier;
9
import com.fasterxml.jackson.databind.module.SimpleModule;
10
import io.github.wistefan.mapping.AdditionalPropertyMixin;
11
import io.github.wistefan.mapping.CacheSerdeableObjectMapper;
12
import io.micronaut.context.event.BeanCreatedEvent;
13
import io.micronaut.context.event.BeanCreatedEventListener;
14
import lombok.RequiredArgsConstructor;
15
import org.fiware.ngsi.model.*;
16

17
import javax.inject.Singleton;
18

19
@Singleton
20
@RequiredArgsConstructor
×
21
public class ObjectMapperEventListener implements BeanCreatedEventListener<ObjectMapper> {
22

23
        @Override
24
        public ObjectMapper onCreated(BeanCreatedEvent<ObjectMapper> event) {
25
                final ObjectMapper objectMapper = event.getBean();
×
26
                // overwrites the NON_EMPTY default, that breaks empty-list handling
27
                objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
×
28

29
                objectMapper.addMixIn(PropertyListVO.class, ListVOMixin.class);
×
30
                objectMapper.addMixIn(RelationshipListVO.class, ListVOMixin.class);
×
31
                objectMapper.addMixIn(GeoPropertyListVO.class, ListVOMixin.class);
×
32
                // when using caches, a specific mapper is required to serialize/desiralize the cache entries.
33
                // we do not want and do not need to overwrite its already configured Mixin's
NEW
34
                if (!(objectMapper instanceof CacheSerdeableObjectMapper)) {
×
NEW
35
                        objectMapper.addMixIn(AdditionalPropertyVO.class, AdditionalPropertyMixin.class);
×
36
                }
37

38
                SimpleModule deserializerModule = new SimpleModule();
×
39
                // inject the schema validator for atSchemaLocation handling
40
                deserializerModule.setDeserializerModifier(new BeanDeserializerModifier() {
×
41
                        @Override
42
                        public JsonDeserializer<?> modifyDeserializer(DeserializationConfig config,
43
                                                                                                                  BeanDescription beanDescription,
44
                                                                                                                  JsonDeserializer<?> originalDeserializer) {
45
                                return new ValidatingDeserializer(originalDeserializer, beanDescription);
×
46
                        }
47
                });
48

49
                objectMapper.registerModule(deserializerModule);
×
50
                return objectMapper;
×
51
        }
52
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc