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

mybatis / generator / 1917

29 Dec 2025 07:50PM UTC coverage: 88.365% (+0.06%) from 88.307%
1917

Pull #1404

github

web-flow
Merge 3f7044080 into 54dabbe6a
Pull Request #1404: Add Support for Generating Java Records to the Java DOM

2523 of 3418 branches covered (73.82%)

95 of 99 new or added lines in 12 files covered. (95.96%)

11286 of 12772 relevant lines covered (88.37%)

0.88 hits per line

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

85.71
/core/mybatis-generator-core/src/main/java/org/mybatis/generator/api/dom/java/TopLevelRecord.java
1
/*
2
 *    Copyright 2006-2025 the original author or authors.
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
 *       https://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 org.mybatis.generator.api.dom.java;
17

18
import java.util.ArrayList;
19
import java.util.List;
20
import java.util.Set;
21
import java.util.TreeSet;
22

23
public class TopLevelRecord extends InnerRecord implements CompilationUnit {
24

25
    private final Set<FullyQualifiedJavaType> importedTypes = new TreeSet<>();
1✔
26

27
    private final Set<String> staticImports = new TreeSet<>();
1✔
28

29
    private final List<String> fileCommentLines = new ArrayList<>();
1✔
30

31
    public TopLevelRecord(FullyQualifiedJavaType type) {
32
        super(type);
1✔
33
    }
1✔
34

35
    public TopLevelRecord(String typeName) {
36
        super(typeName);
1✔
37
    }
1✔
38

39
    @Override
40
    public Set<FullyQualifiedJavaType> getImportedTypes() {
41
        return importedTypes;
1✔
42
    }
43

44
    public void addImportedType(String importedType) {
45
        addImportedType(new FullyQualifiedJavaType(importedType));
1✔
46
    }
1✔
47

48
    @Override
49
    public void addImportedType(FullyQualifiedJavaType importedType) {
50
        if (importedType != null
1!
51
                && importedType.isExplicitlyImported()
1!
52
                && !importedType.getPackageName().equals(
1!
53
                        getType().getPackageName())
1✔
54
                && !importedType.getShortName().equals(getType().getShortName())) {
1!
55
            importedTypes.add(importedType);
1✔
56
        }
57
    }
1✔
58

59
    @Override
60
    public void addFileCommentLine(String commentLine) {
61
        fileCommentLines.add(commentLine);
1✔
62
    }
1✔
63

64
    @Override
65
    public List<String> getFileCommentLines() {
66
        return fileCommentLines;
1✔
67
    }
68

69
    @Override
70
    public void addImportedTypes(Set<FullyQualifiedJavaType> importedTypes) {
NEW
71
        this.importedTypes.addAll(importedTypes);
×
NEW
72
    }
×
73

74
    @Override
75
    public Set<String> getStaticImports() {
76
        return staticImports;
1✔
77
    }
78

79
    @Override
80
    public void addStaticImport(String staticImport) {
81
        staticImports.add(staticImport);
1✔
82
    }
1✔
83

84
    @Override
85
    public void addStaticImports(Set<String> staticImports) {
NEW
86
        this.staticImports.addAll(staticImports);
×
NEW
87
    }
×
88

89
    @Override
90
    public <R> R accept(CompilationUnitVisitor<R> visitor) {
91
        return visitor.visit(this);
1✔
92
    }
93
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc