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

trydofor / professional-wings / #140

08 Feb 2025 09:13AM UTC coverage: 63.606% (-0.08%) from 63.687%
#140

push

web-flow
Merge pull request #316 from trydofor/develop

release of 3.3.140

242 of 343 new or added lines in 58 files covered. (70.55%)

55 existing lines in 6 files now uncovered.

12926 of 20322 relevant lines covered (63.61%)

0.64 hits per line

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

43.33
/wings/slardar/src/main/java/pro/fessional/wings/slardar/jackson/StringMapHelper.java
1
package pro.fessional.wings.slardar.jackson;
2

3
import com.fasterxml.jackson.databind.ObjectMapper;
4
import jakarta.xml.bind.JAXBContext;
5
import jakarta.xml.bind.JAXBException;
6
import jakarta.xml.bind.Marshaller;
7
import org.jetbrains.annotations.NotNull;
8
import pro.fessional.wings.silencer.jaxb.StringMapXmlWriter;
9

10
import java.io.IOException;
11
import java.util.LinkedHashMap;
12
import java.util.Map;
13
import java.util.TreeMap;
14

15
/**
16
 * Signature generation help
17
 *
18
 * @author trydofor
19
 * @since 2019-12-31
20
 */
21
public class StringMapHelper {
×
22

23
    public static Map<String, String> treeJson(Object object, @NotNull ObjectMapper mapper) throws IOException {
24
        StringMapGenerator generator = StringMapGenerator.treeMap();
1✔
25
        mapper.writeValue(generator, object);
1✔
26
        return generator.getResultTree();
1✔
27
    }
28

29
    public static Map<String, String> linkJson(Object object, @NotNull ObjectMapper mapper) throws IOException {
30
        StringMapGenerator generator = StringMapGenerator.linkMap();
×
31
        mapper.writeValue(generator, object);
×
32
        return generator.getResultTree();
×
33
    }
34

35
    public static Map<String, String> treeJaxb(Object object) throws JAXBException {
NEW
36
        return treeJaxb(object, null);
×
37
    }
38

39
    public static Map<String, String> linkJaxb(Object object) throws JAXBException {
NEW
40
        return linkJaxb(object, null);
×
41
    }
42

43
    public static Map<String, String> treeJaxb(Object object, Marshaller marshaller) throws JAXBException {
44
        if (object == null) return new TreeMap<>();
1✔
45
        if (marshaller == null) {
1✔
46
            JAXBContext contextObj = JAXBContext.newInstance(object.getClass());
1✔
47
            marshaller = contextObj.createMarshaller();
1✔
48
        }
49
        StringMapXmlWriter writer = StringMapXmlWriter.treeMap();
1✔
50
        marshaller.marshal(object, writer);
1✔
51
        return writer.getResultTree();
1✔
52
    }
53

54
    public static Map<String, String> linkJaxb(Object object, Marshaller marshaller) throws JAXBException {
NEW
55
        if (object == null) return new LinkedHashMap<>();
×
NEW
56
        if (marshaller == null) {
×
NEW
57
            JAXBContext contextObj = JAXBContext.newInstance(object.getClass());
×
NEW
58
            marshaller = contextObj.createMarshaller();
×
59
        }
60
        StringMapXmlWriter writer = StringMapXmlWriter.linkMap();
×
61
        marshaller.marshal(object, writer);
×
62
        return writer.getResultTree();
×
63
    }
64

65
    public static Map<String, String> json(Object object, ObjectMapper mapper) {
66
        try {
67
            return treeJson(object, mapper);
1✔
68
        }
69
        catch (IOException e) {
×
70
            throw new IllegalStateException(e);
×
71
        }
72
    }
73

74
    public static Map<String, String> jaxb(Object object) {
75
        return jaxb(object, null);
1✔
76
    }
77

78
    public static Map<String, String> jaxb(Object object, Marshaller marshaller) {
79
        try {
80
            return treeJaxb(object, marshaller);
1✔
81
        }
82
        catch (JAXBException e) {
×
83
            throw new IllegalStateException(e);
×
84
        }
85
    }
86
}
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