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

mybatis / generator / 1947

14 Jan 2026 02:31PM UTC coverage: 88.838% (+0.04%) from 88.799%
1947

push

github

web-flow
Merge pull request #1411 from mybatis/renovate/github-codeql-action-digest

Update github/codeql-action digest to cdefb33

2347 of 3184 branches covered (73.71%)

11517 of 12964 relevant lines covered (88.84%)

0.89 hits per line

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

95.86
/core/mybatis-generator-core/src/main/java/org/mybatis/generator/api/IntrospectedTable.java
1
/*
2
 *    Copyright 2006-2026 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;
17

18
import static org.mybatis.generator.internal.util.StringUtility.isTrue;
19
import static org.mybatis.generator.internal.util.StringUtility.stringHasValue;
20

21
import java.util.ArrayList;
22
import java.util.EnumMap;
23
import java.util.HashMap;
24
import java.util.Iterator;
25
import java.util.List;
26
import java.util.Map;
27
import java.util.Objects;
28
import java.util.Optional;
29
import java.util.Properties;
30
import java.util.function.Function;
31
import java.util.stream.Stream;
32

33
import org.jspecify.annotations.Nullable;
34
import org.mybatis.generator.config.Context;
35
import org.mybatis.generator.config.GeneratedKey;
36
import org.mybatis.generator.config.JavaModelGeneratorConfiguration;
37
import org.mybatis.generator.config.PropertyHolder;
38
import org.mybatis.generator.config.PropertyRegistry;
39
import org.mybatis.generator.config.TableConfiguration;
40
import org.mybatis.generator.internal.PluginAggregator;
41
import org.mybatis.generator.internal.rules.ConditionalModelRules;
42
import org.mybatis.generator.internal.rules.FlatModelRules;
43
import org.mybatis.generator.internal.rules.HierarchicalModelRules;
44
import org.mybatis.generator.internal.rules.Rules;
45

46
/**
47
 * Base class for all code generator implementations. This class provides many
48
 * of the housekeeping methods needed to implement a code generator, with only
49
 * the actual code generation methods left unimplemented.
50
 *
51
 * @author Jeff Butler
52
 */
53
public abstract class IntrospectedTable {
54

55
    public enum TargetRuntime {
1✔
56
        MYBATIS3,
1✔
57
        MYBATIS3_DSQL
1✔
58
    }
59

60
    protected enum InternalAttribute {
1✔
61
        ATTR_PRIMARY_KEY_TYPE,
1✔
62
        ATTR_BASE_RECORD_TYPE,
1✔
63
        ATTR_RECORD_WITH_BLOBS_TYPE,
1✔
64
        ATTR_EXAMPLE_TYPE,
1✔
65
        ATTR_MYBATIS3_XML_MAPPER_PACKAGE,
1✔
66
        ATTR_MYBATIS3_XML_MAPPER_FILE_NAME,
1✔
67
        /** also used as XML Mapper namespace if a Java mapper is generated. */
68
        ATTR_MYBATIS3_JAVA_MAPPER_TYPE,
1✔
69
        /** used as XML Mapper namespace if no client is generated. */
70
        ATTR_MYBATIS3_FALLBACK_SQL_MAP_NAMESPACE,
1✔
71
        ATTR_FULLY_QUALIFIED_TABLE_NAME_AT_RUNTIME,
1✔
72
        ATTR_ALIASED_FULLY_QUALIFIED_TABLE_NAME_AT_RUNTIME,
1✔
73
        ATTR_COUNT_BY_EXAMPLE_STATEMENT_ID,
1✔
74
        ATTR_DELETE_BY_EXAMPLE_STATEMENT_ID,
1✔
75
        ATTR_DELETE_BY_PRIMARY_KEY_STATEMENT_ID,
1✔
76
        ATTR_INSERT_STATEMENT_ID,
1✔
77
        ATTR_INSERT_SELECTIVE_STATEMENT_ID,
1✔
78
        ATTR_SELECT_ALL_STATEMENT_ID,
1✔
79
        ATTR_SELECT_BY_EXAMPLE_STATEMENT_ID,
1✔
80
        ATTR_SELECT_BY_EXAMPLE_WITH_BLOBS_STATEMENT_ID,
1✔
81
        ATTR_SELECT_BY_PRIMARY_KEY_STATEMENT_ID,
1✔
82
        ATTR_UPDATE_BY_EXAMPLE_STATEMENT_ID,
1✔
83
        ATTR_UPDATE_BY_EXAMPLE_SELECTIVE_STATEMENT_ID,
1✔
84
        ATTR_UPDATE_BY_EXAMPLE_WITH_BLOBS_STATEMENT_ID,
1✔
85
        ATTR_UPDATE_BY_PRIMARY_KEY_STATEMENT_ID,
1✔
86
        ATTR_UPDATE_BY_PRIMARY_KEY_SELECTIVE_STATEMENT_ID,
1✔
87
        ATTR_UPDATE_BY_PRIMARY_KEY_WITH_BLOBS_STATEMENT_ID,
1✔
88
        ATTR_BASE_RESULT_MAP_ID,
1✔
89
        ATTR_RESULT_MAP_WITH_BLOBS_ID,
1✔
90
        ATTR_EXAMPLE_WHERE_CLAUSE_ID,
1✔
91
        ATTR_BASE_COLUMN_LIST_ID,
1✔
92
        ATTR_BLOB_COLUMN_LIST_ID,
1✔
93
        ATTR_MYBATIS3_UPDATE_BY_EXAMPLE_WHERE_CLAUSE_ID,
1✔
94
        ATTR_MYBATIS3_SQL_PROVIDER_TYPE,
1✔
95
        ATTR_MYBATIS_DYNAMIC_SQL_SUPPORT_TYPE,
1✔
96
        ATTR_KOTLIN_RECORD_TYPE,
1✔
97
        ATTR_MYBATIS_DYNAMIC_SQL_TABLE_OBJECT_NAME
1✔
98
    }
99

100
    /**
101
     * Only nullable because instances of this class are built through introspection. Not null in practice.
102
     */
103
    protected @Nullable TableConfiguration tableConfiguration;
104

105
    /**
106
     * Only nullable because instances of this class are built through introspection. Not null in practice.
107
     */
108
    protected @Nullable FullyQualifiedTable fullyQualifiedTable;
109

110
    /**
111
     * Only nullable because instances of this class are built through introspection. Not null in practice.
112
     */
113
    protected @Nullable Context context;
114

115
    /**
116
     * Only nullable because instances of this class are built through introspection. Not null in practice.
117
     */
118
    protected @Nullable CommentGenerator commentGenerator;
119

120
    /**
121
     * Only nullable because instances of this class are calculated on initialization. Not null in practice.
122
     */
123
    protected @Nullable PluginAggregator pluginAggregator;
124

125
    /**
126
     * Only nullable because instances of this class are calculated on initialization. Not null in practice.
127
     */
128
    protected @Nullable Rules rules;
129

130
    protected final List<IntrospectedColumn> primaryKeyColumns = new ArrayList<>();
1✔
131

132
    protected final List<IntrospectedColumn> baseColumns = new ArrayList<>();
1✔
133

134
    protected final List<IntrospectedColumn> blobColumns = new ArrayList<>();
1✔
135

136
    protected TargetRuntime targetRuntime;
137

138
    /**
139
     * Attributes may be used by plugins to capture table related state between
140
     * the different plugin calls.
141
     */
142
    protected final Map<String, Object> attributes = new HashMap<>();
1✔
143

144
    /** Internal attributes are used to store commonly accessed items by all code generators. */
145
    protected final Map<IntrospectedTable.InternalAttribute, String> internalAttributes =
1✔
146
            new EnumMap<>(InternalAttribute.class);
147

148
    /**
149
     * Table remarks retrieved from database metadata.
150
     */
151
    protected @Nullable String remarks;
152

153
    /**
154
     * Table type retrieved from database metadata.
155
     *
156
     * <p>Non-null in practice
157
     */
158
    protected @Nullable String tableType;
159

160
    protected IntrospectedTable(TargetRuntime targetRuntime) {
1✔
161
        this.targetRuntime = targetRuntime;
1✔
162
    }
1✔
163

164
    public FullyQualifiedTable getFullyQualifiedTable() {
165
        return Objects.requireNonNull(fullyQualifiedTable);
1✔
166
    }
167

168
    public Optional<String> getSelectByExampleQueryId() {
169
        return getTableConfiguration().getSelectByExampleQueryId();
1✔
170
    }
171

172
    public Optional<String> getSelectByPrimaryKeyQueryId() {
173
        return getTableConfiguration().getSelectByPrimaryKeyQueryId();
1✔
174
    }
175

176
    public Optional<GeneratedKey> getGeneratedKey() {
177
        return getTableConfiguration().getGeneratedKey();
1✔
178
    }
179

180
    public Optional<IntrospectedColumn> getColumn(String columnName) {
181
        return Stream.of(primaryKeyColumns.stream(), baseColumns.stream(), blobColumns.stream())
1✔
182
                .flatMap(Function.identity())
1✔
183
                .filter(ic -> columnMatches(ic, columnName))
1✔
184
                .findFirst();
1✔
185
    }
186

187
    private boolean columnMatches(IntrospectedColumn introspectedColumn, String columnName) {
188
        if (introspectedColumn.isColumnNameDelimited()) {
1✔
189
            return introspectedColumn.getActualColumnName().equals(columnName);
1✔
190
        } else {
191
            return introspectedColumn.getActualColumnName().equalsIgnoreCase(columnName);
1✔
192
        }
193
    }
194

195
    /**
196
     * Returns true if any of the columns in the table are JDBC Dates (as
197
     * opposed to timestamps).
198
     *
199
     * @return true if the table contains DATE columns
200
     */
201
    public boolean hasJDBCDateColumns() {
202
        return Stream.of(primaryKeyColumns.stream(), baseColumns.stream())
1✔
203
                .flatMap(Function.identity())
1✔
204
                .anyMatch(IntrospectedColumn::isJDBCDateColumn);
1✔
205
    }
206

207
    /**
208
     * Returns true if any of the columns in the table are JDBC Times (as
209
     * opposed to timestamps).
210
     *
211
     * @return true if the table contains TIME columns
212
     */
213
    public boolean hasJDBCTimeColumns() {
214
        return Stream.of(primaryKeyColumns.stream(), baseColumns.stream())
1✔
215
                .flatMap(Function.identity())
1✔
216
                .anyMatch(IntrospectedColumn::isJDBCTimeColumn);
1✔
217
    }
218

219
    /**
220
     * Returns the columns in the primary key. If the generatePrimaryKeyClass()
221
     * method returns false, then these columns will be iterated as the
222
     * parameters of the selectByPrimaryKay and deleteByPrimaryKey methods
223
     *
224
     * @return a List of ColumnDefinition objects for columns in the primary key
225
     */
226
    public List<IntrospectedColumn> getPrimaryKeyColumns() {
227
        return primaryKeyColumns;
1✔
228
    }
229

230
    public boolean hasPrimaryKeyColumns() {
231
        return !primaryKeyColumns.isEmpty();
1✔
232
    }
233

234
    public List<IntrospectedColumn> getBaseColumns() {
235
        return baseColumns;
1✔
236
    }
237

238
    /**
239
     * Returns all columns in the table (for use by the select by primary key and
240
     * select by example with BLOBs methods).
241
     *
242
     * @return a List of ColumnDefinition objects for all columns in the table
243
     */
244
    public List<IntrospectedColumn> getAllColumns() {
245
        return Stream.of(primaryKeyColumns.stream(), baseColumns.stream(), blobColumns.stream())
1✔
246
                .flatMap(Function.identity())
1✔
247
                .toList();
1✔
248
    }
249

250
    /**
251
     * Returns all columns except BLOBs (for use by the select by example without BLOBs method).
252
     *
253
     * @return a List of ColumnDefinition objects for columns in the table that are non BLOBs
254
     */
255
    public List<IntrospectedColumn> getNonBLOBColumns() {
256
        return Stream.of(primaryKeyColumns.stream(), baseColumns.stream())
1✔
257
                .flatMap(Function.identity())
1✔
258
                .toList();
1✔
259
    }
260

261
    public int getNonBLOBColumnCount() {
262
        return primaryKeyColumns.size() + baseColumns.size();
×
263
    }
264

265
    public List<IntrospectedColumn> getNonPrimaryKeyColumns() {
266
        return Stream.of(baseColumns.stream(), blobColumns.stream())
1✔
267
                .flatMap(Function.identity())
1✔
268
                .toList();
1✔
269
    }
270

271
    public List<IntrospectedColumn> getBLOBColumns() {
272
        return blobColumns;
1✔
273
    }
274

275
    public boolean hasBLOBColumns() {
276
        return !blobColumns.isEmpty();
1✔
277
    }
278

279
    public boolean hasBaseColumns() {
280
        return !baseColumns.isEmpty();
1✔
281
    }
282

283
    public Rules getRules() {
284
        return Objects.requireNonNull(rules);
1✔
285
    }
286

287
    public @Nullable String getTableConfigurationProperty(String property) {
288
        return getTableConfiguration().getProperty(property);
1✔
289
    }
290

291
    public String getPrimaryKeyType() {
292
        return internalAttributes.get(InternalAttribute.ATTR_PRIMARY_KEY_TYPE);
1✔
293
    }
294

295
    /**
296
     * Gets the base record type.
297
     *
298
     * @return the type for the record (the class that holds non-primary key and non-BLOB fields). Note that the value
299
     *         will be calculated regardless of whether the table has these columns or not.
300
     */
301
    public String getBaseRecordType() {
302
        return internalAttributes.get(InternalAttribute.ATTR_BASE_RECORD_TYPE);
1✔
303
    }
304

305
    public String getKotlinRecordType() {
306
        return internalAttributes.get(InternalAttribute.ATTR_KOTLIN_RECORD_TYPE);
1✔
307
    }
308

309
    /**
310
     * Gets the example type.
311
     *
312
     * @return the type for the example class.
313
     */
314
    public String getExampleType() {
315
        return internalAttributes.get(InternalAttribute.ATTR_EXAMPLE_TYPE);
1✔
316
    }
317

318
    /**
319
     * Gets the record with blobs type.
320
     *
321
     * @return the type for the record with BLOBs class. Note that the value will be calculated regardless of whether
322
     *         the table has BLOB columns or not.
323
     */
324
    public String getRecordWithBLOBsType() {
325
        return internalAttributes.get(InternalAttribute.ATTR_RECORD_WITH_BLOBS_TYPE);
1✔
326
    }
327

328
    public String getMyBatis3SqlMapNamespace() {
329
        String namespace = getMyBatis3JavaMapperType();
1✔
330
        if (namespace == null) {
1✔
331
            namespace = getMyBatis3FallbackSqlMapNamespace();
1✔
332
        }
333

334
        return namespace;
1✔
335
    }
336

337
    public String getMyBatis3FallbackSqlMapNamespace() {
338
        return internalAttributes
1✔
339
                .get(InternalAttribute.ATTR_MYBATIS3_FALLBACK_SQL_MAP_NAMESPACE);
1✔
340
    }
341

342
    public boolean hasAnyColumns() {
343
        return hasPrimaryKeyColumns() || hasBaseColumns() || hasBLOBColumns();
1!
344
    }
345

346
    public void setTableConfiguration(TableConfiguration tableConfiguration) {
347
        this.tableConfiguration = tableConfiguration;
1✔
348
    }
1✔
349

350
    public void setFullyQualifiedTable(FullyQualifiedTable fullyQualifiedTable) {
351
        this.fullyQualifiedTable = fullyQualifiedTable;
1✔
352
    }
1✔
353

354
    public void setCommentGenerator(CommentGenerator commentGenerator) {
355
        this.commentGenerator = commentGenerator;
1✔
356
    }
1✔
357

358
    public void setContext(Context context) {
359
        this.context = context;
1✔
360
    }
1✔
361

362
    public void addColumn(IntrospectedColumn introspectedColumn) {
363
        if (introspectedColumn.isBLOBColumn()) {
1✔
364
            blobColumns.add(introspectedColumn);
1✔
365
        } else {
366
            baseColumns.add(introspectedColumn);
1✔
367
        }
368

369
        introspectedColumn.setIntrospectedTable(this);
1✔
370
    }
1✔
371

372
    public void addPrimaryKeyColumn(String columnName) {
373
        boolean found = false;
1✔
374
        // first search base columns
375
        Iterator<IntrospectedColumn> iter = baseColumns.iterator();
1✔
376
        while (iter.hasNext()) {
1!
377
            IntrospectedColumn introspectedColumn = iter.next();
1✔
378
            if (introspectedColumn.getActualColumnName().equals(columnName)) {
1✔
379
                primaryKeyColumns.add(introspectedColumn);
1✔
380
                iter.remove();
1✔
381
                found = true;
1✔
382
                break;
1✔
383
            }
384
        }
1✔
385

386
        // search blob columns in the weird event that a blob is the primary key
387
        if (!found) {
1!
388
            iter = blobColumns.iterator();
×
389
            while (iter.hasNext()) {
×
390
                IntrospectedColumn introspectedColumn = iter.next();
×
391
                if (introspectedColumn.getActualColumnName().equals(columnName)) {
×
392
                    primaryKeyColumns.add(introspectedColumn);
×
393
                    iter.remove();
×
394
                    break;
×
395
                }
396
            }
×
397
        }
398
    }
1✔
399

400
    public Object getAttribute(String name) {
401
        return attributes.get(name);
×
402
    }
403

404
    public void removeAttribute(String name) {
405
        attributes.remove(name);
×
406
    }
×
407

408
    public void setAttribute(String name, Object value) {
409
        attributes.put(name, value);
×
410
    }
×
411

412
    public void initialize(PluginAggregator pluginAggregator, CommentGenerator commentGenerator) {
413
        this.pluginAggregator = pluginAggregator;
1✔
414
        this.commentGenerator = commentGenerator;
1✔
415
        calculateJavaClientAttributes();
1✔
416
        calculateModelAttributes();
1✔
417
        calculateXmlAttributes();
1✔
418

419
        switch (getTableConfiguration().getModelType()) {
1!
420
        case HIERARCHICAL:
421
            rules = new HierarchicalModelRules(this);
1✔
422
            break;
1✔
423
        case FLAT:
424
            rules = new FlatModelRules(this);
1✔
425
            break;
1✔
426
        case CONDITIONAL:
427
            rules = new ConditionalModelRules(this);
1✔
428
            break;
429
        }
430

431
        pluginAggregator.initialized(this);
1✔
432
    }
1✔
433

434
    protected void calculateXmlAttributes() {
435
        setMyBatis3XmlMapperFileName(calculateMyBatis3XmlMapperFileName());
1✔
436
        setMyBatis3XmlMapperPackage(calculateSqlMapPackage());
1✔
437

438
        setMyBatis3FallbackSqlMapNamespace(calculateMyBatis3FallbackSqlMapNamespace());
1✔
439

440
        setSqlMapFullyQualifiedRuntimeTableName(calculateSqlMapFullyQualifiedRuntimeTableName());
1✔
441
        setSqlMapAliasedFullyQualifiedRuntimeTableName(calculateSqlMapAliasedFullyQualifiedRuntimeTableName());
1✔
442

443
        setCountByExampleStatementId("countByExample"); //$NON-NLS-1$
1✔
444
        setDeleteByExampleStatementId("deleteByExample"); //$NON-NLS-1$
1✔
445
        setDeleteByPrimaryKeyStatementId("deleteByPrimaryKey"); //$NON-NLS-1$
1✔
446
        setInsertStatementId("insert"); //$NON-NLS-1$
1✔
447
        setInsertSelectiveStatementId("insertSelective"); //$NON-NLS-1$
1✔
448
        setSelectAllStatementId("selectAll"); //$NON-NLS-1$
1✔
449
        setSelectByExampleStatementId("selectByExample"); //$NON-NLS-1$
1✔
450
        setSelectByExampleWithBLOBsStatementId("selectByExampleWithBLOBs"); //$NON-NLS-1$
1✔
451
        setSelectByPrimaryKeyStatementId("selectByPrimaryKey"); //$NON-NLS-1$
1✔
452
        setUpdateByExampleStatementId("updateByExample"); //$NON-NLS-1$
1✔
453
        setUpdateByExampleSelectiveStatementId("updateByExampleSelective"); //$NON-NLS-1$
1✔
454
        setUpdateByExampleWithBLOBsStatementId("updateByExampleWithBLOBs"); //$NON-NLS-1$
1✔
455
        setUpdateByPrimaryKeyStatementId("updateByPrimaryKey"); //$NON-NLS-1$
1✔
456
        setUpdateByPrimaryKeySelectiveStatementId("updateByPrimaryKeySelective"); //$NON-NLS-1$
1✔
457
        setUpdateByPrimaryKeyWithBLOBsStatementId("updateByPrimaryKeyWithBLOBs"); //$NON-NLS-1$
1✔
458
        setBaseResultMapId("BaseResultMap"); //$NON-NLS-1$
1✔
459
        setResultMapWithBLOBsId("ResultMapWithBLOBs"); //$NON-NLS-1$
1✔
460
        setExampleWhereClauseId("Example_Where_Clause"); //$NON-NLS-1$
1✔
461
        setBaseColumnListId("Base_Column_List"); //$NON-NLS-1$
1✔
462
        setBlobColumnListId("Blob_Column_List"); //$NON-NLS-1$
1✔
463
        setMyBatis3UpdateByExampleWhereClauseId("Update_By_Example_Where_Clause"); //$NON-NLS-1$
1✔
464
    }
1✔
465

466
    public void setBlobColumnListId(String s) {
467
        internalAttributes.put(InternalAttribute.ATTR_BLOB_COLUMN_LIST_ID, s);
1✔
468
    }
1✔
469

470
    public void setBaseColumnListId(String s) {
471
        internalAttributes.put(InternalAttribute.ATTR_BASE_COLUMN_LIST_ID, s);
1✔
472
    }
1✔
473

474
    public void setExampleWhereClauseId(String s) {
475
        internalAttributes.put(InternalAttribute.ATTR_EXAMPLE_WHERE_CLAUSE_ID, s);
1✔
476
    }
1✔
477

478
    public void setMyBatis3UpdateByExampleWhereClauseId(String s) {
479
        internalAttributes.put(InternalAttribute.ATTR_MYBATIS3_UPDATE_BY_EXAMPLE_WHERE_CLAUSE_ID, s);
1✔
480
    }
1✔
481

482
    public void setResultMapWithBLOBsId(String s) {
483
        internalAttributes.put(InternalAttribute.ATTR_RESULT_MAP_WITH_BLOBS_ID, s);
1✔
484
    }
1✔
485

486
    public void setBaseResultMapId(String s) {
487
        internalAttributes.put(InternalAttribute.ATTR_BASE_RESULT_MAP_ID, s);
1✔
488
    }
1✔
489

490
    public void setUpdateByPrimaryKeyWithBLOBsStatementId(String s) {
491
        internalAttributes.put(InternalAttribute.ATTR_UPDATE_BY_PRIMARY_KEY_WITH_BLOBS_STATEMENT_ID, s);
1✔
492
    }
1✔
493

494
    public void setUpdateByPrimaryKeySelectiveStatementId(String s) {
495
        internalAttributes.put(InternalAttribute.ATTR_UPDATE_BY_PRIMARY_KEY_SELECTIVE_STATEMENT_ID, s);
1✔
496
    }
1✔
497

498
    public void setUpdateByPrimaryKeyStatementId(String s) {
499
        internalAttributes.put(InternalAttribute.ATTR_UPDATE_BY_PRIMARY_KEY_STATEMENT_ID, s);
1✔
500
    }
1✔
501

502
    public void setUpdateByExampleWithBLOBsStatementId(String s) {
503
        internalAttributes.put(InternalAttribute.ATTR_UPDATE_BY_EXAMPLE_WITH_BLOBS_STATEMENT_ID, s);
1✔
504
    }
1✔
505

506
    public void setUpdateByExampleSelectiveStatementId(String s) {
507
        internalAttributes.put(InternalAttribute.ATTR_UPDATE_BY_EXAMPLE_SELECTIVE_STATEMENT_ID, s);
1✔
508
    }
1✔
509

510
    public void setUpdateByExampleStatementId(String s) {
511
        internalAttributes.put(InternalAttribute.ATTR_UPDATE_BY_EXAMPLE_STATEMENT_ID, s);
1✔
512
    }
1✔
513

514
    public void setSelectByPrimaryKeyStatementId(String s) {
515
        internalAttributes.put(InternalAttribute.ATTR_SELECT_BY_PRIMARY_KEY_STATEMENT_ID, s);
1✔
516
    }
1✔
517

518
    public void setSelectByExampleWithBLOBsStatementId(String s) {
519
        internalAttributes.put(InternalAttribute.ATTR_SELECT_BY_EXAMPLE_WITH_BLOBS_STATEMENT_ID, s);
1✔
520
    }
1✔
521

522
    public void setSelectAllStatementId(String s) {
523
        internalAttributes.put(InternalAttribute.ATTR_SELECT_ALL_STATEMENT_ID, s);
1✔
524
    }
1✔
525

526
    public void setSelectByExampleStatementId(String s) {
527
        internalAttributes.put(InternalAttribute.ATTR_SELECT_BY_EXAMPLE_STATEMENT_ID, s);
1✔
528
    }
1✔
529

530
    public void setInsertSelectiveStatementId(String s) {
531
        internalAttributes.put(InternalAttribute.ATTR_INSERT_SELECTIVE_STATEMENT_ID, s);
1✔
532
    }
1✔
533

534
    public void setInsertStatementId(String s) {
535
        internalAttributes.put(InternalAttribute.ATTR_INSERT_STATEMENT_ID, s);
1✔
536
    }
1✔
537

538
    public void setDeleteByPrimaryKeyStatementId(String s) {
539
        internalAttributes.put(InternalAttribute.ATTR_DELETE_BY_PRIMARY_KEY_STATEMENT_ID, s);
1✔
540
    }
1✔
541

542
    public void setDeleteByExampleStatementId(String s) {
543
        internalAttributes.put(InternalAttribute.ATTR_DELETE_BY_EXAMPLE_STATEMENT_ID, s);
1✔
544
    }
1✔
545

546
    public void setCountByExampleStatementId(String s) {
547
        internalAttributes.put(InternalAttribute.ATTR_COUNT_BY_EXAMPLE_STATEMENT_ID, s);
1✔
548
    }
1✔
549

550
    public String getBlobColumnListId() {
551
        return internalAttributes.get(InternalAttribute.ATTR_BLOB_COLUMN_LIST_ID);
1✔
552
    }
553

554
    public String getBaseColumnListId() {
555
        return internalAttributes.get(InternalAttribute.ATTR_BASE_COLUMN_LIST_ID);
1✔
556
    }
557

558
    public String getExampleWhereClauseId() {
559
        return internalAttributes.get(InternalAttribute.ATTR_EXAMPLE_WHERE_CLAUSE_ID);
1✔
560
    }
561

562
    public String getMyBatis3UpdateByExampleWhereClauseId() {
563
        return internalAttributes.get(InternalAttribute.ATTR_MYBATIS3_UPDATE_BY_EXAMPLE_WHERE_CLAUSE_ID);
1✔
564
    }
565

566
    public String getResultMapWithBLOBsId() {
567
        return internalAttributes.get(InternalAttribute.ATTR_RESULT_MAP_WITH_BLOBS_ID);
1✔
568
    }
569

570
    public String getBaseResultMapId() {
571
        return internalAttributes.get(InternalAttribute.ATTR_BASE_RESULT_MAP_ID);
1✔
572
    }
573

574
    public String getUpdateByPrimaryKeyWithBLOBsStatementId() {
575
        return internalAttributes.get(InternalAttribute.ATTR_UPDATE_BY_PRIMARY_KEY_WITH_BLOBS_STATEMENT_ID);
1✔
576
    }
577

578
    public String getUpdateByPrimaryKeySelectiveStatementId() {
579
        return internalAttributes.get(InternalAttribute.ATTR_UPDATE_BY_PRIMARY_KEY_SELECTIVE_STATEMENT_ID);
1✔
580
    }
581

582
    public String getUpdateByPrimaryKeyStatementId() {
583
        return internalAttributes.get(InternalAttribute.ATTR_UPDATE_BY_PRIMARY_KEY_STATEMENT_ID);
1✔
584
    }
585

586
    public String getUpdateByExampleWithBLOBsStatementId() {
587
        return internalAttributes.get(InternalAttribute.ATTR_UPDATE_BY_EXAMPLE_WITH_BLOBS_STATEMENT_ID);
1✔
588
    }
589

590
    public String getUpdateByExampleSelectiveStatementId() {
591
        return internalAttributes.get(InternalAttribute.ATTR_UPDATE_BY_EXAMPLE_SELECTIVE_STATEMENT_ID);
1✔
592
    }
593

594
    public String getUpdateByExampleStatementId() {
595
        return internalAttributes.get(InternalAttribute.ATTR_UPDATE_BY_EXAMPLE_STATEMENT_ID);
1✔
596
    }
597

598
    public String getSelectByPrimaryKeyStatementId() {
599
        return internalAttributes.get(InternalAttribute.ATTR_SELECT_BY_PRIMARY_KEY_STATEMENT_ID);
1✔
600
    }
601

602
    public String getSelectByExampleWithBLOBsStatementId() {
603
        return internalAttributes.get(InternalAttribute.ATTR_SELECT_BY_EXAMPLE_WITH_BLOBS_STATEMENT_ID);
1✔
604
    }
605

606
    public String getSelectAllStatementId() {
607
        return internalAttributes.get(InternalAttribute.ATTR_SELECT_ALL_STATEMENT_ID);
1✔
608
    }
609

610
    public String getSelectByExampleStatementId() {
611
        return internalAttributes.get(InternalAttribute.ATTR_SELECT_BY_EXAMPLE_STATEMENT_ID);
1✔
612
    }
613

614
    public String getInsertSelectiveStatementId() {
615
        return internalAttributes.get(InternalAttribute.ATTR_INSERT_SELECTIVE_STATEMENT_ID);
1✔
616
    }
617

618
    public String getInsertStatementId() {
619
        return internalAttributes.get(InternalAttribute.ATTR_INSERT_STATEMENT_ID);
1✔
620
    }
621

622
    public String getDeleteByPrimaryKeyStatementId() {
623
        return internalAttributes.get(InternalAttribute.ATTR_DELETE_BY_PRIMARY_KEY_STATEMENT_ID);
1✔
624
    }
625

626
    public String getDeleteByExampleStatementId() {
627
        return internalAttributes.get(InternalAttribute.ATTR_DELETE_BY_EXAMPLE_STATEMENT_ID);
1✔
628
    }
629

630
    public String getCountByExampleStatementId() {
631
        return internalAttributes.get(InternalAttribute.ATTR_COUNT_BY_EXAMPLE_STATEMENT_ID);
1✔
632
    }
633

634
    public String getMyBatisDynamicSQLTableObjectName() {
635
        return internalAttributes.get(InternalAttribute.ATTR_MYBATIS_DYNAMIC_SQL_TABLE_OBJECT_NAME);
1✔
636
    }
637

638
    public void setMyBatisDynamicSQLTableObjectName(String name) {
639
        internalAttributes.put(InternalAttribute.ATTR_MYBATIS_DYNAMIC_SQL_TABLE_OBJECT_NAME, name);
1✔
640
    }
1✔
641

642
    private boolean isSubPackagesEnabled(PropertyHolder propertyHolder) {
643
        return isTrue(propertyHolder.getProperty(PropertyRegistry.ANY_ENABLE_SUB_PACKAGES));
1✔
644
    }
645

646
    protected @Nullable String calculateJavaClientInterfacePackage() {
647
        return getContext().getJavaClientGeneratorConfiguration()
1✔
648
                .map(c -> c.getTargetPackage()
1✔
649
                        + getFullyQualifiedTable().getSubPackageForClientOrSqlMap(isSubPackagesEnabled(c)))
1✔
650
                .orElse(null);
1✔
651
    }
652

653
    protected @Nullable String calculateDynamicSqlSupportPackage() {
654
        return getContext().getJavaClientGeneratorConfiguration()
1✔
655
                .map(c -> {
1✔
656
                    String packkage = c.getProperty(PropertyRegistry.CLIENT_DYNAMIC_SQL_SUPPORT_PACKAGE);
1✔
657
                    if (stringHasValue(packkage)) {
1✔
658
                        return packkage
1✔
659
                                + getFullyQualifiedTable().getSubPackageForClientOrSqlMap(isSubPackagesEnabled(c));
1✔
660
                    } else {
661
                        return calculateJavaClientInterfacePackage();
1✔
662
                    }
663
                }).orElse(null);
1✔
664
    }
665

666
    protected void calculateJavaClientAttributes() {
667
        if (getContext().getJavaClientGeneratorConfiguration().isEmpty()) {
1✔
668
            return;
1✔
669
        }
670

671
        StringBuilder sb = new StringBuilder();
1✔
672
        sb.append(calculateJavaClientInterfacePackage());
1✔
673
        sb.append('.');
1✔
674
        if (stringHasValue(getTableConfiguration().getMapperName())) {
1✔
675
            sb.append(getTableConfiguration().getMapperName());
1✔
676
        } else {
677
            getFullyQualifiedTable().getDomainObjectSubPackage().ifPresent(sp -> sb.append(sp).append('.'));
1✔
678
            sb.append(getFullyQualifiedTable().getDomainObjectName());
1✔
679
            sb.append("Mapper"); //$NON-NLS-1$
1✔
680
        }
681
        setMyBatis3JavaMapperType(sb.toString());
1✔
682

683
        sb.setLength(0);
1✔
684
        sb.append(calculateJavaClientInterfacePackage());
1✔
685
        sb.append('.');
1✔
686
        if (stringHasValue(getTableConfiguration().getSqlProviderName())) {
1!
687
            sb.append(getTableConfiguration().getSqlProviderName());
×
688
        } else {
689
            getFullyQualifiedTable().getDomainObjectSubPackage().ifPresent(sp -> sb.append(sp).append('.'));
1✔
690
            sb.append(getFullyQualifiedTable().getDomainObjectName());
1✔
691
            sb.append("SqlProvider"); //$NON-NLS-1$
1✔
692
        }
693
        setMyBatis3SqlProviderType(sb.toString());
1✔
694

695
        sb.setLength(0);
1✔
696
        sb.append(calculateDynamicSqlSupportPackage());
1✔
697
        sb.append('.');
1✔
698
        if (stringHasValue(getTableConfiguration().getDynamicSqlSupportClassName())) {
1✔
699
            sb.append(getTableConfiguration().getDynamicSqlSupportClassName());
1✔
700
        } else {
701
            getFullyQualifiedTable().getDomainObjectSubPackage().ifPresent(sp -> sb.append(sp).append('.'));
1✔
702
            sb.append(getFullyQualifiedTable().getDomainObjectName());
1✔
703
            sb.append("DynamicSqlSupport"); //$NON-NLS-1$
1✔
704
        }
705
        setMyBatisDynamicSqlSupportType(sb.toString());
1✔
706

707
        if (stringHasValue(getTableConfiguration().getDynamicSqlTableObjectName())) {
1✔
708
            setMyBatisDynamicSQLTableObjectName(getTableConfiguration().getDynamicSqlTableObjectName());
1✔
709
        } else {
710
            setMyBatisDynamicSQLTableObjectName(getFullyQualifiedTable().getDomainObjectName());
1✔
711
        }
712
    }
1✔
713

714
    protected String calculateJavaModelPackage() {
715
        JavaModelGeneratorConfiguration config = getContext().getJavaModelGeneratorConfiguration();
1✔
716

717
        return config.getTargetPackage() + getFullyQualifiedTable().getSubPackageForModel(isSubPackagesEnabled(config));
1✔
718
    }
719

720
    protected void calculateModelAttributes() {
721
        String pakkage = calculateJavaModelPackage();
1✔
722

723
        StringBuilder sb = new StringBuilder();
1✔
724
        sb.append(pakkage);
1✔
725
        sb.append('.');
1✔
726
        sb.append(getFullyQualifiedTable().getDomainObjectName());
1✔
727
        sb.append("Key"); //$NON-NLS-1$
1✔
728
        setPrimaryKeyType(sb.toString());
1✔
729

730
        sb.setLength(0);
1✔
731
        sb.append(pakkage);
1✔
732
        sb.append('.');
1✔
733
        sb.append(getFullyQualifiedTable().getDomainObjectName());
1✔
734
        setBaseRecordType(sb.toString());
1✔
735

736
        sb.setLength(0);
1✔
737
        sb.append(pakkage);
1✔
738
        sb.append('.');
1✔
739
        sb.append(getFullyQualifiedTable().getDomainObjectName());
1✔
740
        setKotlinRecordType(sb.toString());
1✔
741

742
        sb.setLength(0);
1✔
743
        sb.append(pakkage);
1✔
744
        sb.append('.');
1✔
745
        sb.append(getFullyQualifiedTable().getDomainObjectName());
1✔
746
        sb.append("WithBLOBs"); //$NON-NLS-1$
1✔
747
        setRecordWithBLOBsType(sb.toString());
1✔
748

749
        String exampleTargetPackage = calculateJavaModelExamplePackage();
1✔
750
        sb.setLength(0);
1✔
751
        sb.append(exampleTargetPackage);
1✔
752
        sb.append('.');
1✔
753
        sb.append(getFullyQualifiedTable().getDomainObjectName());
1✔
754
        sb.append("Example"); //$NON-NLS-1$
1✔
755
        setExampleType(sb.toString());
1✔
756
    }
1✔
757

758
    /**
759
     * If property exampleTargetPackage specified for example use the specified value, else
760
     * use default value (targetPackage).
761
     *
762
     * @return the calculated package
763
     */
764
    protected String calculateJavaModelExamplePackage() {
765
        JavaModelGeneratorConfiguration config = getContext().getJavaModelGeneratorConfiguration();
1✔
766
        String exampleTargetPackage = config.getProperty(PropertyRegistry.MODEL_GENERATOR_EXAMPLE_PACKAGE);
1✔
767
        if (!stringHasValue(exampleTargetPackage)) {
1✔
768
            return calculateJavaModelPackage();
1✔
769
        }
770

771
        return exampleTargetPackage + getFullyQualifiedTable().getSubPackageForModel(isSubPackagesEnabled(config));
1✔
772
    }
773

774
    protected String calculateSqlMapPackage() {
775
        StringBuilder sb = new StringBuilder();
1✔
776
        // config can be null if the Java client does not require XML
777
        getContext().getSqlMapGeneratorConfiguration().ifPresent(config -> {
1✔
778
            sb.append(config.getTargetPackage());
1✔
779
            sb.append(getFullyQualifiedTable().getSubPackageForClientOrSqlMap(isSubPackagesEnabled(config)));
1✔
780
            if (stringHasValue(getTableConfiguration().getMapperName())) {
1✔
781
                String mapperName = getTableConfiguration().getMapperName();
1✔
782
                int ind = mapperName.lastIndexOf('.');
1✔
783
                if (ind != -1) {
1✔
784
                    sb.append('.').append(mapperName, 0, ind);
1✔
785
                }
786
            } else {
1✔
787
                getFullyQualifiedTable().getDomainObjectSubPackage().ifPresent(sp -> sb.append('.').append(sp));
1✔
788
            }
789
        });
1✔
790

791
        return sb.toString();
1✔
792
    }
793

794
    protected String calculateMyBatis3XmlMapperFileName() {
795
        StringBuilder sb = new StringBuilder();
1✔
796
        if (stringHasValue(getTableConfiguration().getMapperName())) {
1✔
797
            String mapperName = getTableConfiguration().getMapperName();
1✔
798
            int ind = mapperName.lastIndexOf('.');
1✔
799
            if (ind == -1) {
1✔
800
                sb.append(mapperName);
1✔
801
            } else {
802
                sb.append(mapperName.substring(ind + 1));
1✔
803
            }
804
            sb.append(".xml"); //$NON-NLS-1$
1✔
805
        } else {
1✔
806
            sb.append(getFullyQualifiedTable().getDomainObjectName());
1✔
807
            sb.append("Mapper.xml"); //$NON-NLS-1$
1✔
808
        }
809
        return sb.toString();
1✔
810
    }
811

812
    protected String calculateMyBatis3FallbackSqlMapNamespace() {
813
        StringBuilder sb = new StringBuilder();
1✔
814
        sb.append(calculateSqlMapPackage());
1✔
815
        sb.append('.');
1✔
816
        if (stringHasValue(getTableConfiguration().getMapperName())) {
1✔
817
            sb.append(getTableConfiguration().getMapperName());
1✔
818
        } else {
819
            sb.append(getFullyQualifiedTable().getDomainObjectName());
1✔
820
            sb.append("Mapper"); //$NON-NLS-1$
1✔
821
        }
822
        return sb.toString();
1✔
823
    }
824

825
    protected String calculateSqlMapFullyQualifiedRuntimeTableName() {
826
        return getFullyQualifiedTable().getFullyQualifiedTableNameAtRuntime();
1✔
827
    }
828

829
    protected String calculateSqlMapAliasedFullyQualifiedRuntimeTableName() {
830
        return getFullyQualifiedTable().getAliasedFullyQualifiedTableNameAtRuntime();
1✔
831
    }
832

833
    public String getFullyQualifiedTableNameAtRuntime() {
834
        return internalAttributes.get(InternalAttribute.ATTR_FULLY_QUALIFIED_TABLE_NAME_AT_RUNTIME);
1✔
835
    }
836

837
    public String getAliasedFullyQualifiedTableNameAtRuntime() {
838
        return internalAttributes.get(InternalAttribute.ATTR_ALIASED_FULLY_QUALIFIED_TABLE_NAME_AT_RUNTIME);
1✔
839
    }
840

841
    /**
842
     * This method can be used to initialize the generators before they will be called.
843
     *
844
     * <p>This method is called after all the setX methods, but before getNumberOfSubtasks(), getGeneratedJavaFiles, and
845
     * getGeneratedXmlFiles.
846
     *
847
     * @param warnings
848
     *            the warnings
849
     * @param progressCallback
850
     *            the progress callback
851
     */
852
    public abstract void calculateGenerators(List<String> warnings, ProgressCallback progressCallback);
853

854
    /**
855
     * This method should return a list of generated Java files related to this
856
     * table. This list could include various types of model classes, as well as
857
     * DAO classes.
858
     *
859
     * @return the list of generated Java files for this table
860
     */
861
    public abstract List<GeneratedJavaFile> getGeneratedJavaFiles();
862

863
    /**
864
     * This method should return a list of generated XML files related to this
865
     * table. Most implementations will only return one file - the generated
866
     * SqlMap file.
867
     *
868
     * @return the list of generated XML files for this table
869
     */
870
    public abstract List<GeneratedXmlFile> getGeneratedXmlFiles();
871

872
    /**
873
     * This method should return a list of generated Kotlin files related to this
874
     * table. This list could include a data classes, a mapper interface, extension methods, etc.
875
     *
876
     * @return the list of generated Kotlin files for this table
877
     */
878
    public abstract List<GeneratedKotlinFile> getGeneratedKotlinFiles();
879

880
    /**
881
     * This method should return the number of progress messages that will be
882
     * sent during the generation phase.
883
     *
884
     * @return the number of progress messages
885
     */
886
    public abstract int getGenerationSteps();
887

888
    /**
889
     * This method exists to give plugins the opportunity to replace the calculated rules if necessary.
890
     *
891
     * @param rules
892
     *            the new rules
893
     */
894
    public void setRules(Rules rules) {
895
        this.rules = rules;
×
896
    }
×
897

898
    public TableConfiguration getTableConfiguration() {
899
        return Objects.requireNonNull(tableConfiguration);
1✔
900
    }
901

902
    public void setPrimaryKeyType(String primaryKeyType) {
903
        internalAttributes.put(InternalAttribute.ATTR_PRIMARY_KEY_TYPE, primaryKeyType);
1✔
904
    }
1✔
905

906
    public void setBaseRecordType(String baseRecordType) {
907
        internalAttributes.put(InternalAttribute.ATTR_BASE_RECORD_TYPE, baseRecordType);
1✔
908
    }
1✔
909

910
    public void setKotlinRecordType(String kotlinRecordType) {
911
        internalAttributes.put(InternalAttribute.ATTR_KOTLIN_RECORD_TYPE, kotlinRecordType);
1✔
912
    }
1✔
913

914
    public void setRecordWithBLOBsType(String recordWithBLOBsType) {
915
        internalAttributes.put(InternalAttribute.ATTR_RECORD_WITH_BLOBS_TYPE, recordWithBLOBsType);
1✔
916
    }
1✔
917

918
    public void setExampleType(String exampleType) {
919
        internalAttributes.put(InternalAttribute.ATTR_EXAMPLE_TYPE, exampleType);
1✔
920
    }
1✔
921

922
    public void setMyBatis3FallbackSqlMapNamespace(String sqlMapNamespace) {
923
        internalAttributes.put(InternalAttribute.ATTR_MYBATIS3_FALLBACK_SQL_MAP_NAMESPACE, sqlMapNamespace);
1✔
924
    }
1✔
925

926
    public void setSqlMapFullyQualifiedRuntimeTableName(String fullyQualifiedRuntimeTableName) {
927
        internalAttributes.put(InternalAttribute.ATTR_FULLY_QUALIFIED_TABLE_NAME_AT_RUNTIME,
1✔
928
                fullyQualifiedRuntimeTableName);
929
    }
1✔
930

931
    public void setSqlMapAliasedFullyQualifiedRuntimeTableName(String aliasedFullyQualifiedRuntimeTableName) {
932
        internalAttributes.put(InternalAttribute.ATTR_ALIASED_FULLY_QUALIFIED_TABLE_NAME_AT_RUNTIME,
1✔
933
                        aliasedFullyQualifiedRuntimeTableName);
934
    }
1✔
935

936
    public String getMyBatis3XmlMapperPackage() {
937
        return internalAttributes.get(InternalAttribute.ATTR_MYBATIS3_XML_MAPPER_PACKAGE);
1✔
938
    }
939

940
    public void setMyBatis3XmlMapperPackage(String mybatis3XmlMapperPackage) {
941
        internalAttributes.put(InternalAttribute.ATTR_MYBATIS3_XML_MAPPER_PACKAGE, mybatis3XmlMapperPackage);
1✔
942
    }
1✔
943

944
    public String getMyBatis3XmlMapperFileName() {
945
        return internalAttributes.get(InternalAttribute.ATTR_MYBATIS3_XML_MAPPER_FILE_NAME);
1✔
946
    }
947

948
    public void setMyBatis3XmlMapperFileName(String mybatis3XmlMapperFileName) {
949
        internalAttributes.put(InternalAttribute.ATTR_MYBATIS3_XML_MAPPER_FILE_NAME, mybatis3XmlMapperFileName);
1✔
950
    }
1✔
951

952
    public String getMyBatis3JavaMapperType() {
953
        return internalAttributes.get(InternalAttribute.ATTR_MYBATIS3_JAVA_MAPPER_TYPE);
1✔
954
    }
955

956
    public void setMyBatis3JavaMapperType(String mybatis3JavaMapperType) {
957
        internalAttributes.put(InternalAttribute.ATTR_MYBATIS3_JAVA_MAPPER_TYPE, mybatis3JavaMapperType);
1✔
958
    }
1✔
959

960
    public String getMyBatis3SqlProviderType() {
961
        return internalAttributes.get(InternalAttribute.ATTR_MYBATIS3_SQL_PROVIDER_TYPE);
1✔
962
    }
963

964
    public void setMyBatis3SqlProviderType(String mybatis3SqlProviderType) {
965
        internalAttributes.put(InternalAttribute.ATTR_MYBATIS3_SQL_PROVIDER_TYPE, mybatis3SqlProviderType);
1✔
966
    }
1✔
967

968
    public String getMyBatisDynamicSqlSupportType() {
969
        return internalAttributes.get(InternalAttribute.ATTR_MYBATIS_DYNAMIC_SQL_SUPPORT_TYPE);
1✔
970
    }
971

972
    public void setMyBatisDynamicSqlSupportType(String s) {
973
        internalAttributes.put(InternalAttribute.ATTR_MYBATIS_DYNAMIC_SQL_SUPPORT_TYPE, s);
1✔
974
    }
1✔
975

976
    public TargetRuntime getTargetRuntime() {
977
        return targetRuntime;
1✔
978
    }
979

980
    public boolean isImmutable() {
981
        Properties properties;
982

983
        if (getTableConfiguration().getProperties().containsKey(PropertyRegistry.ANY_IMMUTABLE)) {
1✔
984
            properties = getTableConfiguration().getProperties();
1✔
985
        } else {
986
            properties = getContext().getJavaModelGeneratorConfiguration().getProperties();
1✔
987
        }
988

989
        return isTrue(properties.getProperty(PropertyRegistry.ANY_IMMUTABLE));
1✔
990
    }
991

992
    public boolean isConstructorBased() {
993
        if (isImmutable()) {
1✔
994
            return true;
1✔
995
        }
996

997
        Properties properties;
998

999
        if (getTableConfiguration().getProperties().containsKey(PropertyRegistry.ANY_CONSTRUCTOR_BASED)) {
1✔
1000
            properties = getTableConfiguration().getProperties();
1✔
1001
        } else {
1002
            properties = getContext().getJavaModelGeneratorConfiguration().getProperties();
1✔
1003
        }
1004

1005
        return isTrue(properties.getProperty(PropertyRegistry.ANY_CONSTRUCTOR_BASED));
1✔
1006
    }
1007

1008
    /**
1009
     * Should return true if an XML generator is required for this table. This method will be called during validation
1010
     * of the configuration, so it should not rely on database introspection. This method simply tells the validator if
1011
     * an XML configuration is normally required for this implementation.
1012
     *
1013
     * @return true, if successful
1014
     */
1015
    public abstract boolean requiresXMLGenerator();
1016

1017
    public Context getContext() {
1018
        return Objects.requireNonNull(context);
1✔
1019
    }
1020

1021
    public Optional<String> getRemarks() {
1022
        return Optional.ofNullable(remarks);
1✔
1023
    }
1024

1025
    public void setRemarks(String remarks) {
1026
        this.remarks = remarks;
1✔
1027
    }
1✔
1028

1029
    public String getTableType() {
1030
        return Objects.requireNonNull(tableType);
1✔
1031
    }
1032

1033
    public void setTableType(String tableType) {
1034
        this.tableType = tableType;
1✔
1035
    }
1✔
1036
}
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