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

torand / jsonschema2java / 18399814123

10 Oct 2025 07:35AM UTC coverage: 78.214% (-0.9%) from 79.157%
18399814123

push

github

torand
fix: bean validation annotations on primitive subtypes of compound pojo property types now generated

287 of 413 branches covered (69.49%)

Branch coverage included in aggregate %.

440 of 533 new or added lines in 26 files covered. (82.55%)

1 existing line in 1 file now uncovered.

808 of 987 relevant lines covered (81.86%)

4.75 hits per line

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

80.95
/src/main/java/io/github/torand/jsonschema2java/model/ImportInfo.java
1
/*
2
 * Copyright (c) 2024-2025 Tore Eide Andersen
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *      http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16
package io.github.torand.jsonschema2java.model;
17

18
import java.util.Collection;
19
import java.util.Set;
20
import java.util.TreeSet;
21

22
import static io.github.torand.javacommons.stream.StreamHelper.streamSafely;
23
import static java.util.Collections.emptySet;
24

25
/**
26
 * Describes a collection of imports and static imports.
27
 * @param normalImports the normal (non-static) imports.
28
 * @param staticImports the static imports.
29
 */
30
public record ImportInfo(
9✔
31
    Set<String> normalImports,
32
    Set<String> staticImports
33
) implements ImportsSupplier {
34

35
    /**
36
     * Creates an {@link ImportInfo} object with no imports.
37
     * @return the empty {@link ImportInfo} object.
38
     */
39
    public static ImportInfo empty() {
40
        return new ImportInfo();
4✔
41
    }
42

43
    /**
44
     * Constructs an {@link ImportInfo} object.
45
     */
46
    private ImportInfo() {
47
        this(emptySet(), emptySet());
4✔
48
    }
1✔
49

50
    @Override
51
    public ImportInfo imports() {
NEW
52
        return this;
×
53
    }
54

55
    /**
56
     * Returns a new {@link ImportInfo} object with specified normal import added.
57
     * @param normalImport the import to add.
58
     * @return the new and updated {@link ImportInfo} object.
59
     */
60
    public ImportInfo withAddedNormalImport(String normalImport) {
61
        Set<String> newNormalImports = new TreeSet<>(this.normalImports);
6✔
62
        newNormalImports.add(normalImport);
4✔
63
        return new ImportInfo(newNormalImports, staticImports);
7✔
64
    }
65

66
    /**
67
     * Returns a new {@link ImportInfo} object with specified static import added.
68
     * @param staticImport the static import to add.
69
     * @return the new and updated {@link ImportInfo} object.
70
     */
71
    public ImportInfo withAddedStaticImport(String staticImport) {
NEW
72
        Set<String> newStaticImports = new TreeSet<>(this.staticImports);
×
NEW
73
        newStaticImports.add(staticImport);
×
NEW
74
        return new ImportInfo(normalImports, newStaticImports);
×
75
    }
76

77
    /**
78
     * Returns a new {@link ImportInfo} object with all imports from specified supplier added.
79
     * @param importSupplier the imports to add.
80
     * @return the new and updated {@link ImportInfo} object.
81
     */
82
    public ImportInfo withAddedImports(ImportsSupplier importSupplier) {
83
        Set<String> newNormalImports = new TreeSet<>(this.normalImports);
6✔
84
        newNormalImports.addAll(importSupplier.imports().normalImports());
6✔
85
        Set<String> newStaticImports = new TreeSet<>(this.staticImports);
6✔
86
        newStaticImports.addAll(importSupplier.imports().staticImports());
6✔
87

88
        return new ImportInfo(newNormalImports, newStaticImports);
6✔
89
    }
90

91
    /**
92
     * Returns a new {@link ImportInfo} object with all imports from specified suppliers added.
93
     * @param importSuppliers the imports to add.
94
     * @return the new and updated {@link ImportInfo} object.
95
     */
96
    public ImportInfo withAddedImports(Collection<? extends ImportsSupplier> importSuppliers) {
97
        Set<String> newNormalImports = new TreeSet<>(this.normalImports);
6✔
98
        streamSafely(importSuppliers).map(ImportsSupplier::imports).map(ImportInfo::normalImports).forEach(newNormalImports::addAll);
12✔
99
        Set<String> newStaticImports = new TreeSet<>(this.staticImports);
6✔
100
        streamSafely(importSuppliers).map(ImportsSupplier::imports).map(ImportInfo::staticImports).forEach(newStaticImports::addAll);
12✔
101

102
        return new ImportInfo(newNormalImports, newStaticImports);
6✔
103
    }
104
}
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