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 java.util.Collections;
19 import java.util.List;
20 import java.util.Properties;
21
22 import org.mybatis.generator.api.dom.java.Field;
23 import org.mybatis.generator.api.dom.java.Interface;
24 import org.mybatis.generator.api.dom.java.Method;
25 import org.mybatis.generator.api.dom.java.TopLevelClass;
26 import org.mybatis.generator.api.dom.java.TopLevelRecord;
27 import org.mybatis.generator.api.dom.kotlin.KotlinFile;
28 import org.mybatis.generator.api.dom.kotlin.KotlinFunction;
29 import org.mybatis.generator.api.dom.kotlin.KotlinProperty;
30 import org.mybatis.generator.api.dom.kotlin.KotlinType;
31 import org.mybatis.generator.api.dom.xml.Document;
32 import org.mybatis.generator.api.dom.xml.XmlElement;
33 import org.mybatis.generator.config.Context;
34
35 /**
36 * This interface defines methods that will be called at different times during
37 * the code generation process. These methods can be used to extend or modify
38 * the generated code. Clients may implement this interface in its entirety, or
39 * extend the PluginAdapter (highly recommended).
40 *
41 * <p>Plugins have a lifecycle. In general, the lifecycle is this:
42 *
43 * <ol>
44 * <li>The setXXX methods are called one time</li>
45 * <li>The validate method is called one time</li>
46 * <li>The initialized method is called for each introspected table</li>
47 * <li>The clientXXX methods are called for each introspected table</li>
48 * <li>The providerXXX methods are called for each introspected table</li>
49 * <li>The modelXXX methods are called for each introspected table</li>
50 * <li>The sqlMapXXX methods are called for each introspected table</li>
51 * <li>The contextGenerateAdditionalJavaFiles(IntrospectedTable) method is
52 * called for each introspected table</li>
53 * <li>The contextGenerateAdditionalXmlFiles(IntrospectedTable) method is called
54 * for each introspected table</li>
55 * <li>The contextGenerateAdditionalJavaFiles() method is called one time</li>
56 * <li>The contextGenerateAdditionalXmlFiles() method is called one time</li>
57 * </ol>
58 *
59 * <p>Plugins are related to contexts - so each context will have its own set of
60 * plugins. If the same plugin is specified in multiple contexts, then each
61 * context will hold a unique instance of the plugin.
62 *
63 * <p>Plugins are called, and initialized, in the same order they are specified in
64 * the configuration.
65 *
66 * <p>The clientXXX, modelXXX, and sqlMapXXX methods are called by the code
67 * generators. If you replace the default code generators with other
68 * implementations, these methods may not be called.
69 *
70 * @author Jeff Butler
71 *
72 * @see PluginAdapter
73 */
74 public interface Plugin {
75
76 enum ModelClassType {
77 PRIMARY_KEY,
78 BASE_RECORD,
79 RECORD_WITH_BLOBS
80 }
81
82 /**
83 * Set the context under which this plugin is running.
84 *
85 * @param context
86 * the new context
87 */
88 void setContext(Context context);
89
90 /**
91 * Set properties from the plugin configuration.
92 *
93 * @param properties
94 * the new properties
95 */
96 void setProperties(Properties properties);
97
98 /**
99 * Set the comment generator for the current context.
100 *
101 * @param commentGenerator the comment generator
102 */
103 void setCommentGenerator(CommentGenerator commentGenerator);
104
105 void setKnownRuntime(KnownRuntime knownRuntime);
106
107 /**
108 * This method is called just before the getGeneratedXXXFiles methods are called on the introspected table. Plugins
109 * can implement this method to override any of the default attributes, or change the results of database
110 * introspection, before any code generation activities occur. Attributes are listed as static Strings with the
111 * prefix ATTR_ in IntrospectedTable.
112 *
113 * <p>A good example of overriding an attribute would be the case where a user wanted to change the name of one
114 * of the generated classes, change the target package, or change the name of the generated SQL map file.
115 *
116 * <p><b>Warning:</b> Anything that is listed as an attribute should not be changed by one of the other plugin
117 * methods. For example, if you want to change the name of a generated example class, you should not simply change
118 * the Type in the <code>modelExampleClassGenerated()</code> method. If you do, the change will not be reflected
119 * in other generated artifacts.
120 *
121 * @param introspectedTable
122 * the introspected table
123 */
124 default void initialized(IntrospectedTable introspectedTable) {}
125
126 /**
127 * This method is called after all the setXXX methods are called, but before
128 * any other method is called. This allows the plugin to determine whether
129 * it can run or not. For example, if the plugin requires certain properties
130 * to be set, and the properties are not set, then the plugin is invalid and
131 * will not run.
132 *
133 * @param warnings
134 * add strings to this list to specify warnings. For example, if
135 * the plugin is invalid, you should specify why. Warnings are
136 * reported to users after the completion of the run.
137 * @return true if the plugin is in a valid state. Invalid plugins will not
138 * be called
139 */
140 boolean validate(List<String> warnings);
141
142 /**
143 * This method can be used to generate any additional Java file needed by
144 * your implementation. This method is called once, after all other Java
145 * files have been generated.
146 *
147 * @return a List of GeneratedJavaFiles - these files will be saved
148 * with the other files from this run.
149 */
150 default List<GeneratedJavaFile> contextGenerateAdditionalJavaFiles() {
151 return Collections.emptyList();
152 }
153
154 /**
155 * This method can be used to generate additional Java files needed by your
156 * implementation that might be related to a specific table. This method is
157 * called once for every table in the configuration.
158 *
159 * @param introspectedTable
160 * The class containing information about the table as
161 * introspected from the database
162 * @return a List of GeneratedJavaFiles - these files will be saved
163 * with the other files from this run.
164 */
165 default List<GeneratedJavaFile> contextGenerateAdditionalJavaFiles(IntrospectedTable introspectedTable) {
166 return Collections.emptyList();
167 }
168
169 default List<GeneratedKotlinFile> contextGenerateAdditionalKotlinFiles() {
170 return Collections.emptyList();
171 }
172
173 default List<GeneratedKotlinFile> contextGenerateAdditionalKotlinFiles(IntrospectedTable introspectedTable) {
174 return Collections.emptyList();
175 }
176
177 default List<GenericGeneratedFile> contextGenerateAdditionalFiles() {
178 return Collections.emptyList();
179 }
180
181 default List<GenericGeneratedFile> contextGenerateAdditionalFiles(IntrospectedTable introspectedTable) {
182 return Collections.emptyList();
183 }
184
185 /**
186 * This method can be used to generate any additional XML file needed by
187 * your implementation. This method is called once, after all other XML
188 * files have been generated.
189 *
190 * @return a List of GeneratedXmlFiles - these files will be saved
191 * with the other files from this run.
192 */
193 default List<GeneratedXmlFile> contextGenerateAdditionalXmlFiles() {
194 return Collections.emptyList();
195 }
196
197 /**
198 * This method can be used to generate additional XML files needed by your
199 * implementation that might be related to a specific table. This method is
200 * called once for every table in the configuration.
201 *
202 * @param introspectedTable
203 * The class containing information about the table as
204 * introspected from the database
205 * @return a List of GeneratedXmlFiles - these files will be saved
206 * with the other files from this run.
207 */
208 default List<GeneratedXmlFile> contextGenerateAdditionalXmlFiles(IntrospectedTable introspectedTable) {
209 return Collections.emptyList();
210 }
211
212 /**
213 * This method is called when the entire client has been generated.
214 * Implement this method to add additional methods or fields to a generated
215 * client interface or implementation.
216 *
217 * @param interfaze
218 * the generated interface if any, may be null
219 * @param introspectedTable
220 * The class containing information about the table as
221 * introspected from the database
222 * @return true if the interface should be generated, false if the generated
223 * interface should be ignored. In the case of multiple plugins, the
224 * first plugin returning false will disable the calling of further
225 * plugins.
226 */
227 default boolean clientGenerated(Interface interfaze, IntrospectedTable introspectedTable) {
228 return true;
229 }
230
231 /**
232 * This method is called when the insert method has been generated for the mapper interface.
233 * This method is only called in the MyBatis3DynamicSql runtime. This method is only
234 * called if the table has generated keys.
235 *
236 * @param method
237 * the generated insert method
238 * @param interfaze
239 * the partially generated mapper interfaces
240 * @param introspectedTable
241 * The class containing information about the table as introspected from the database
242 * @return true if the method should be generated, false if the generated
243 * method should be ignored. In the case of multiple plugins, the
244 * first plugin returning false will disable the calling of further
245 * plugins.
246 */
247 default boolean clientBasicInsertMethodGenerated(Method method, Interface interfaze,
248 IntrospectedTable introspectedTable) {
249 return true;
250 }
251
252 /**
253 * This method is called when the insert function has been generated for the mapper interface.
254 * This method is only called in the MyBatis3Kotlin runtime. This method is only
255 * called if the table has generated keys.
256 *
257 * @param kotlinFunction
258 * the generated insert function
259 * @param kotlinFile
260 * the partially generated file
261 * @param introspectedTable
262 * The class containing information about the table as introspected from the database
263 * @return true if the function should be generated, false if the generated
264 * function should be ignored. In the case of multiple plugins, the
265 * first plugin returning false will disable the calling of further
266 * plugins.
267 */
268 default boolean clientBasicInsertMethodGenerated(KotlinFunction kotlinFunction, KotlinFile kotlinFile,
269 IntrospectedTable introspectedTable) {
270 return true;
271 }
272
273 /**
274 * This method is called when the insert multiple method has been generated for the mapper interface.
275 * This method is only called in the MyBatis3DynamicSql runtime. This method is only
276 * called if the table has generated keys.
277 *
278 * @param method
279 * the generated insert method
280 * @param interfaze
281 * the partially generated mapper interfaces
282 * @param introspectedTable
283 * The class containing information about the table as introspected from the database
284 * @return true if the method should be generated, false if the generated
285 * method should be ignored. In the case of multiple plugins, the
286 * first plugin returning false will disable the calling of further
287 * plugins.
288 */
289 default boolean clientBasicInsertMultipleMethodGenerated(Method method, Interface interfaze,
290 IntrospectedTable introspectedTable) {
291 return true;
292 }
293
294 /**
295 * This method is called when the insert multiple method has been generated for the mapper interface.
296 * This method is only called in the MyBatis3DynamicSql runtime. This method is only
297 * called if the table has generated keys.
298 *
299 * @param kotlinFunction
300 * the generated insert function
301 * @param kotlinFile
302 * the partially generated file
303 * @param introspectedTable
304 * The class containing information about the table as introspected from the database
305 * @return true if the method should be generated, false if the generated
306 * function should be ignored. In the case of multiple plugins, the
307 * first plugin returning false will disable the calling of further
308 * plugins.
309 */
310 default boolean clientBasicInsertMultipleMethodGenerated(KotlinFunction kotlinFunction, KotlinFile kotlinFile,
311 IntrospectedTable introspectedTable) {
312 return true;
313 }
314
315 /**
316 * This method is called when the selectMany method has been generated for the mapper interface.
317 * This method is only called in the MyBatis3DynamicSql runtime.
318 *
319 * @param method
320 * the generated selectMany method
321 * @param interfaze
322 * the partially generated mapper interfaces
323 * @param introspectedTable
324 * The class containing information about the table as introspected from the database
325 * @return true if the method should be generated, false if the generated
326 * method should be ignored. In the case of multiple plugins, the
327 * first plugin returning false will disable the calling of further
328 * plugins.
329 */
330 default boolean clientBasicSelectManyMethodGenerated(Method method, Interface interfaze,
331 IntrospectedTable introspectedTable) {
332 return true;
333 }
334
335 default boolean clientBasicSelectManyMethodGenerated(KotlinFunction kotlinFunction, KotlinFile kotlinFile,
336 IntrospectedTable introspectedTable) {
337 return true;
338 }
339
340 /**
341 * This method is called when the selectOne method has been generated for the mapper interface.
342 * This method is only called in the MyBatis3DynamicSql runtime.
343 *
344 * @param method
345 * the generated selectOne method
346 * @param interfaze
347 * the partially generated mapper interfaces
348 * @param introspectedTable
349 * The class containing information about the table as introspected from the database
350 * @return true if the method should be generated, false if the generated
351 * method should be ignored. In the case of multiple plugins, the
352 * first plugin returning false will disable the calling of further
353 * plugins.
354 */
355 default boolean clientBasicSelectOneMethodGenerated(Method method, Interface interfaze,
356 IntrospectedTable introspectedTable) {
357 return true;
358 }
359
360 default boolean clientBasicSelectOneMethodGenerated(KotlinFunction kotlinFunction, KotlinFile kotlinFile,
361 IntrospectedTable introspectedTable) {
362 return true;
363 }
364
365 /**
366 * This method is called when the countByExample method has been generated
367 * in the client interface.
368 *
369 * @param method
370 * the generated countByExample method
371 * @param interfaze
372 * the partially implemented client interface. You can add
373 * additional imported classes to the interface if
374 * necessary.
375 * @param introspectedTable
376 * The class containing information about the table as
377 * introspected from the database
378 * @return true if the method should be generated, false if the generated
379 * method should be ignored. In the case of multiple plugins, the
380 * first plugin returning false will disable the calling of further
381 * plugins.
382 */
383 default boolean clientCountByExampleMethodGenerated(Method method,
384 Interface interfaze, IntrospectedTable introspectedTable) {
385 return true;
386 }
387
388 /**
389 * This method is called when the deleteByExample method has been generated
390 * in the client interface.
391 *
392 * @param method
393 * the generated deleteByExample method
394 * @param interfaze
395 * the partially implemented client interface. You can add
396 * additional imported classes to the interface if
397 * necessary.
398 * @param introspectedTable
399 * The class containing information about the table as
400 * introspected from the database
401 * @return true if the method should be generated, false if the generated
402 * method should be ignored. In the case of multiple plugins, the
403 * first plugin returning false will disable the calling of further
404 * plugins.
405 */
406 default boolean clientDeleteByExampleMethodGenerated(Method method,
407 Interface interfaze, IntrospectedTable introspectedTable) {
408 return true;
409 }
410
411 /**
412 * This method is called when the deleteByPrimaryKey method has been
413 * generated in the client interface.
414 *
415 * @param method
416 * the generated deleteByPrimaryKey method
417 * @param interfaze
418 * the partially implemented client interface. You can add
419 * additional imported classes to the interface if
420 * necessary.
421 * @param introspectedTable
422 * The class containing information about the table as
423 * introspected from the database
424 * @return true if the method should be generated, false if the generated
425 * method should be ignored. In the case of multiple plugins, the
426 * first plugin returning false will disable the calling of further
427 * plugins.
428 */
429 default boolean clientDeleteByPrimaryKeyMethodGenerated(Method method,
430 Interface interfaze, IntrospectedTable introspectedTable) {
431 return true;
432 }
433
434 default boolean clientDeleteByPrimaryKeyMethodGenerated(KotlinFunction kotlinFunction, KotlinFile kotlinFile,
435 IntrospectedTable introspectedTable) {
436 return true;
437 }
438
439 /**
440 * Called when the general count method has been generated. This is the replacement for countByExample
441 * in the MyBatis Dynamic SQL V2 runtime.
442 *
443 * @param method
444 * the generated general count method
445 * @param interfaze
446 * the partially generated mapper interfaces
447 * @param introspectedTable
448 * The class containing information about the table as
449 * introspected from the database
450 * @return true if the method should be generated
451 */
452 default boolean clientGeneralCountMethodGenerated(Method method, Interface interfaze,
453 IntrospectedTable introspectedTable) {
454 return true;
455 }
456
457 default boolean clientGeneralCountMethodGenerated(KotlinFunction kotlinFunction, KotlinFile kotlinFile,
458 IntrospectedTable introspectedTable) {
459 return true;
460 }
461
462 /**
463 * Called when the general delete method has been generated. This is the replacement for deleteByExample
464 * in the MyBatis Dynamic SQL V2 runtime.
465 *
466 * @param method
467 * the generated general delete method
468 * @param interfaze
469 * the partially generated mapper interfaces
470 * @param introspectedTable
471 * The class containing information about the table as
472 * introspected from the database
473 * @return true if the method should be generated
474 */
475 default boolean clientGeneralDeleteMethodGenerated(Method method, Interface interfaze,
476 IntrospectedTable introspectedTable) {
477 return true;
478 }
479
480 default boolean clientGeneralDeleteMethodGenerated(KotlinFunction kotlinFunction, KotlinFile kotlinFile,
481 IntrospectedTable introspectedTable) {
482 return true;
483 }
484
485 /**
486 * Called when the general select distinct method has been generated. This is the replacement for
487 * selectDistinctByExample in the MyBatis Dynamic SQL V2 runtime.
488 *
489 * @param method
490 * the generated general select distinct method
491 * @param interfaze
492 * the partially generated mapper interfaces
493 * @param introspectedTable
494 * The class containing information about the table as
495 * introspected from the database
496 * @return true if the method should be generated
497 */
498 default boolean clientGeneralSelectDistinctMethodGenerated(Method method, Interface interfaze,
499 IntrospectedTable introspectedTable) {
500 return true;
501 }
502
503 default boolean clientGeneralSelectDistinctMethodGenerated(KotlinFunction kotlinFunction, KotlinFile kotlinFile,
504 IntrospectedTable introspectedTable) {
505 return true;
506 }
507
508 /**
509 * Called when the general select method has been generated. This is the replacement for
510 * selectByExample in the MyBatis Dynamic SQL V2 runtime.
511 *
512 * @param method
513 * the generated general select method
514 * @param interfaze
515 * the partially generated mapper interfaces
516 * @param introspectedTable
517 * The class containing information about the table as
518 * introspected from the database
519 * @return true if the method should be generated
520 */
521 default boolean clientGeneralSelectMethodGenerated(Method method, Interface interfaze,
522 IntrospectedTable introspectedTable) {
523 return true;
524 }
525
526 default boolean clientGeneralSelectMethodGenerated(KotlinFunction kotlinFunction, KotlinFile kotlinFile,
527 IntrospectedTable introspectedTable) {
528 return true;
529 }
530
531 /**
532 * Called when the general update method has been generated. This is the replacement for
533 * updateByExample in the MyBatis Dynamic SQL V2 runtime.
534 *
535 * @param method
536 * the generated general update method
537 * @param interfaze
538 * the partially generated mapper interfaces
539 * @param introspectedTable
540 * The class containing information about the table as
541 * introspected from the database
542 * @return true if the method should be generated
543 */
544 default boolean clientGeneralUpdateMethodGenerated(Method method, Interface interfaze,
545 IntrospectedTable introspectedTable) {
546 return true;
547 }
548
549 default boolean clientGeneralUpdateMethodGenerated(KotlinFunction kotlinFunction, KotlinFile kotlinFile,
550 IntrospectedTable introspectedTable) {
551 return true;
552 }
553
554 /**
555 * This method is called when the insert method has been generated in the
556 * client interface.
557 *
558 * @param method
559 * the generated insert method
560 * @param interfaze
561 * the partially implemented client interface. You can add
562 * additional imported classes to the interface if
563 * necessary.
564 * @param introspectedTable
565 * The class containing information about the table as
566 * introspected from the database
567 * @return true if the method should be generated, false if the generated
568 * method should be ignored. In the case of multiple plugins, the
569 * first plugin returning false will disable the calling of further
570 * plugins.
571 */
572 default boolean clientInsertMethodGenerated(Method method, Interface interfaze,
573 IntrospectedTable introspectedTable) {
574 return true;
575 }
576
577 default boolean clientInsertMethodGenerated(KotlinFunction kotlinFunction, KotlinFile kotlinFile,
578 IntrospectedTable introspectedTable) {
579 return true;
580 }
581
582 /**
583 * This method is called when the insert multiple method has been generated in the
584 * client interface.
585 * This method is only called in the MyBatis3DynamicSql runtime.
586 *
587 * @param method
588 * the generated insert multiple method
589 * @param interfaze
590 * the partially implemented client interface. You can add
591 * additional imported classes to the interface if
592 * necessary.
593 * @param introspectedTable
594 * The class containing information about the table as
595 * introspected from the database
596 * @return true if the method should be generated, false if the generated
597 * method should be ignored. In the case of multiple plugins, the
598 * first plugin returning false will disable the calling of further
599 * plugins.
600 */
601 default boolean clientInsertMultipleMethodGenerated(Method method, Interface interfaze,
602 IntrospectedTable introspectedTable) {
603 return true;
604 }
605
606 default boolean clientInsertMultipleMethodGenerated(KotlinFunction kotlinFunction, KotlinFile kotlinFile,
607 IntrospectedTable introspectedTable) {
608 return true;
609 }
610
611 /**
612 * This method is called when the insert selective method has been generated
613 * in the client interface.
614 *
615 * @param method
616 * the generated insert method
617 * @param interfaze
618 * the partially implemented client interface. You can add
619 * additional imported classes to the interface if
620 * necessary.
621 * @param introspectedTable
622 * The class containing information about the table as
623 * introspected from the database
624 * @return true if the method should be generated, false if the generated
625 * method should be ignored. In the case of multiple plugins, the
626 * first plugin returning false will disable the calling of further
627 * plugins.
628 */
629 default boolean clientInsertSelectiveMethodGenerated(Method method,
630 Interface interfaze, IntrospectedTable introspectedTable) {
631 return true;
632 }
633
634 default boolean clientInsertSelectiveMethodGenerated(KotlinFunction kotlinFunction, KotlinFile kotlinFile,
635 IntrospectedTable introspectedTable) {
636 return true;
637 }
638
639 /**
640 * This method is called when the selectByExampleWithBLOBs method has been
641 * generated in the client interface.
642 *
643 * @param method
644 * the generated selectByExampleWithBLOBs method
645 * @param interfaze
646 * the partially implemented client interface. You can add
647 * additional imported classes to the interface if
648 * necessary.
649 * @param introspectedTable
650 * The class containing information about the table as
651 * introspected from the database
652 * @return true if the method should be generated, false if the generated
653 * method should be ignored. In the case of multiple plugins, the
654 * first plugin returning false will disable the calling of further
655 * plugins.
656 */
657 default boolean clientSelectByExampleWithBLOBsMethodGenerated(Method method,
658 Interface interfaze, IntrospectedTable introspectedTable) {
659 return true;
660 }
661
662 /**
663 * This method is called when the selectByExampleWithoutBLOBs method has
664 * been generated in the client interface.
665 *
666 * @param method
667 * the generated selectByExampleWithoutBLOBs method
668 * @param interfaze
669 * the partially implemented client interface. You can add
670 * additional imported classes to the interface if
671 * necessary.
672 * @param introspectedTable
673 * The class containing information about the table as
674 * introspected from the database
675 * @return true if the method should be generated, false if the generated
676 * method should be ignored. In the case of multiple plugins, the
677 * first plugin returning false will disable the calling of further
678 * plugins.
679 */
680 default boolean clientSelectByExampleWithoutBLOBsMethodGenerated(Method method,
681 Interface interfaze, IntrospectedTable introspectedTable) {
682 return true;
683 }
684
685 /**
686 * This method is called when the selectByPrimaryKey method has been
687 * generated in the client interface.
688 *
689 * @param method
690 * the generated selectByPrimaryKey method
691 * @param interfaze
692 * the partially implemented client interface. You can add
693 * additional imported classes to the interface if
694 * necessary.
695 * @param introspectedTable
696 * The class containing information about the table as
697 * introspected from the database
698 * @return true if the method should be generated, false if the generated
699 * method should be ignored. In the case of multiple plugins, the
700 * first plugin returning false will disable the calling of further
701 * plugins.
702 */
703 default boolean clientSelectByPrimaryKeyMethodGenerated(Method method,
704 Interface interfaze, IntrospectedTable introspectedTable) {
705 return true;
706 }
707
708 default boolean clientSelectByPrimaryKeyMethodGenerated(KotlinFunction kotlinFunction, KotlinFile kotlinFile,
709 IntrospectedTable introspectedTable) {
710 return true;
711 }
712
713 /**
714 * Called when the selectList field is generated in a MyBatis Dynamic SQL V2 runtime.
715 *
716 * @param field the generated selectList field
717 * @param interfaze
718 * the partially generated mapper interfaces
719 * @param introspectedTable
720 * The class containing information about the table as
721 * introspected from the database
722 * @return true if the field should be generated
723 */
724 default boolean clientSelectListFieldGenerated(Field field, Interface interfaze,
725 IntrospectedTable introspectedTable) {
726 return true;
727 }
728
729 /**
730 * Called when the selectOne method is generated. This is a new method in the MyBatis Dynamic SQL V2 runtime.
731 *
732 * @param method
733 * the generated selectOne method
734 * @param interfaze
735 * the partially generated mapper interfaces
736 * @param introspectedTable
737 * The class containing information about the table as
738 * introspected from the database
739 * @return true if the method should be generated
740 */
741 default boolean clientSelectOneMethodGenerated(Method method, Interface interfaze,
742 IntrospectedTable introspectedTable) {
743 return true;
744 }
745
746 default boolean clientSelectOneMethodGenerated(KotlinFunction kotlinFunction, KotlinFile kotlinFile,
747 IntrospectedTable introspectedTable) {
748 return true;
749 }
750
751 /**
752 * This method is called when the updateByExampleSelective method has been
753 * generated in the client interface.
754 *
755 * @param method
756 * the generated updateByExampleSelective method
757 * @param interfaze
758 * the partially implemented client interface. You can add
759 * additional imported classes to the interface if
760 * necessary.
761 * @param introspectedTable
762 * The class containing information about the table as
763 * introspected from the database
764 * @return true if the method should be generated, false if the generated
765 * method should be ignored. In the case of multiple plugins, the
766 * first plugin returning false will disable the calling of further
767 * plugins.
768 */
769 default boolean clientUpdateByExampleSelectiveMethodGenerated(Method method,
770 Interface interfaze, IntrospectedTable introspectedTable) {
771 return true;
772 }
773
774 /**
775 * Called when the updateAllColumns method is generated. The generated method can be used with the general
776 * update method to mimic the function of the old updateByExample method.
777 *
778 * @param method
779 * the generated updateAllColumns method
780 * @param interfaze
781 * the partially generated mapper interfaces
782 * @param introspectedTable
783 * The class containing information about the table as
784 * introspected from the database
785 * @return true if the method should be generated
786 */
787 default boolean clientUpdateAllColumnsMethodGenerated(Method method, Interface interfaze,
788 IntrospectedTable introspectedTable) {
789 return true;
790 }
791
792 default boolean clientUpdateAllColumnsMethodGenerated(KotlinFunction kotlinFunction, KotlinFile kotlinFile,
793 IntrospectedTable introspectedTable) {
794 return true;
795 }
796
797 /**
798 * Called when the updateSelectiveColumns method is generated. The generated method can be used with the general
799 * update method to mimic the function of the old updateByExampleSelective method.
800 *
801 * @param method
802 * the generated updateSelectiveColumns method
803 * @param interfaze
804 * the partially generated mapper interfaces
805 * @param introspectedTable
806 * The class containing information about the table as
807 * introspected from the database
808 * @return true if the method should be generated
809 */
810 default boolean clientUpdateSelectiveColumnsMethodGenerated(Method method, Interface interfaze,
811 IntrospectedTable introspectedTable) {
812 return true;
813 }
814
815 default boolean clientUpdateSelectiveColumnsMethodGenerated(KotlinFunction kotlinFunction, KotlinFile kotlinFile,
816 IntrospectedTable introspectedTable) {
817 return true;
818 }
819
820 /**
821 * This method is called when the updateByExampleWithBLOBs method has been
822 * generated in the client interface.
823 *
824 * @param method
825 * the generated updateByExampleWithBLOBs method
826 * @param interfaze
827 * the partially implemented client interface. You can add
828 * additional imported classes to the interface if
829 * necessary.
830 * @param introspectedTable
831 * The class containing information about the table as
832 * introspected from the database
833 * @return true if the method should be generated, false if the generated
834 * method should be ignored. In the case of multiple plugins, the
835 * first plugin returning false will disable the calling of further
836 * plugins.
837 */
838 default boolean clientUpdateByExampleWithBLOBsMethodGenerated(Method method,
839 Interface interfaze, IntrospectedTable introspectedTable) {
840 return true;
841 }
842
843 /**
844 * This method is called when the updateByExampleWithoutBLOBs method has
845 * been generated in the client interface.
846 *
847 * @param method
848 * the generated updateByExampleWithoutBLOBs method
849 * @param interfaze
850 * the partially implemented client interface. You can add
851 * additional imported classes to the interface if
852 * necessary.
853 * @param introspectedTable
854 * The class containing information about the table as
855 * introspected from the database
856 * @return true if the method should be generated, false if the generated
857 * method should be ignored. In the case of multiple plugins, the
858 * first plugin returning false will disable the calling of further
859 * plugins.
860 */
861 default boolean clientUpdateByExampleWithoutBLOBsMethodGenerated(Method method,
862 Interface interfaze, IntrospectedTable introspectedTable) {
863 return true;
864 }
865
866 /**
867 * This method is called when the updateByPrimaryKeySelective method has
868 * been generated in the client interface.
869 *
870 * @param method
871 * the generated updateByPrimaryKeySelective method
872 * @param interfaze
873 * the partially implemented client interface. You can add
874 * additional imported classes to the interface if
875 * necessary.
876 * @param introspectedTable
877 * The class containing information about the table as
878 * introspected from the database
879 * @return true if the method should be generated, false if the generated
880 * method should be ignored. In the case of multiple plugins, the
881 * first plugin returning false will disable the calling of further
882 * plugins.
883 */
884 default boolean clientUpdateByPrimaryKeySelectiveMethodGenerated(Method method,
885 Interface interfaze, IntrospectedTable introspectedTable) {
886 return true;
887 }
888
889 default boolean clientUpdateByPrimaryKeySelectiveMethodGenerated(KotlinFunction kotlinFunction,
890 KotlinFile kotlinFile, IntrospectedTable introspectedTable) {
891 return true;
892 }
893
894 /**
895 * This method is called when the updateByPrimaryKeyWithBLOBs method has
896 * been generated in the client interface.
897 *
898 * @param method
899 * the generated updateByPrimaryKeyWithBLOBs method
900 * @param interfaze
901 * the partially implemented client interface. You can add
902 * additional imported classes to the interface if
903 * necessary.
904 * @param introspectedTable
905 * The class containing information about the table as
906 * introspected from the database
907 * @return true if the method should be generated, false if the generated
908 * method should be ignored. In the case of multiple plugins, the
909 * first plugin returning false will disable the calling of further
910 * plugins.
911 */
912 default boolean clientUpdateByPrimaryKeyWithBLOBsMethodGenerated(Method method,
913 Interface interfaze, IntrospectedTable introspectedTable) {
914 return true;
915 }
916
917 /**
918 * This method is called when the updateByPrimaryKeyWithoutBLOBs method has
919 * been generated in the client interface.
920 *
921 * @param method
922 * the generated updateByPrimaryKeyWithoutBLOBs method
923 * @param interfaze
924 * the partially implemented client interface. You can add
925 * additional imported classes to the interface if
926 * necessary.
927 * @param introspectedTable
928 * The class containing information about the table as
929 * introspected from the database
930 * @return true if the method should be generated, false if the generated
931 * method should be ignored. In the case of multiple plugins, the
932 * first plugin returning false will disable the calling of further
933 * plugins.
934 */
935 default boolean clientUpdateByPrimaryKeyWithoutBLOBsMethodGenerated(Method method,
936 Interface interfaze, IntrospectedTable introspectedTable) {
937 return true;
938 }
939
940 /**
941 * This method is called when the selectAll method has been
942 * generated in the client interface. This method is only generated by
943 * the simple runtime.
944 *
945 * @param method
946 * the generated selectAll method
947 * @param interfaze
948 * the partially implemented client interface. You can add
949 * additional imported classes to the interface if
950 * necessary.
951 * @param introspectedTable
952 * The class containing information about the table as
953 * introspected from the database
954 * @return true if the method should be generated, false if the generated
955 * method should be ignored. In the case of multiple plugins, the
956 * first plugin returning false will disable the calling of further
957 * plugins.
958 */
959 default boolean clientSelectAllMethodGenerated(Method method,
960 Interface interfaze, IntrospectedTable introspectedTable) {
961 return true;
962 }
963
964 /**
965 * This method is called after the field is generated for a specific column
966 * in a table.
967 *
968 * @param field
969 * the field generated for the specified column
970 * @param topLevelClass
971 * the partially implemented model class. You can add additional
972 * imported classes to the implementation class if necessary.
973 * @param introspectedColumn
974 * The class containing information about the column related
975 * to this field as introspected from the database
976 * @param introspectedTable
977 * The class containing information about the table as
978 * introspected from the database
979 * @param modelClassType
980 * the type of class that the field is generated for
981 * @return true if the field should be generated, false if the generated
982 * field should be ignored. In the case of multiple plugins, the
983 * first plugin returning false will disable the calling of further
984 * plugins.
985 */
986 default boolean modelFieldGenerated(Field field, TopLevelClass topLevelClass,
987 IntrospectedColumn introspectedColumn,
988 IntrospectedTable introspectedTable, ModelClassType modelClassType) {
989 return true;
990 }
991
992 /**
993 * This method is called after the getter, or accessor, method is generated
994 * for a specific column in a table.
995 *
996 * @param method
997 * the getter, or accessor, method generated for the specified
998 * column
999 * @param topLevelClass
1000 * the partially implemented model class. You can add additional
1001 * imported classes to the implementation class if necessary.
1002 * @param introspectedColumn
1003 * The class containing information about the column related
1004 * to this field as introspected from the database
1005 * @param introspectedTable
1006 * The class containing information about the table as
1007 * introspected from the database
1008 * @param modelClassType
1009 * the type of class that the field is generated for
1010 * @return true if the method should be generated, false if the generated
1011 * method should be ignored. In the case of multiple plugins, the
1012 * first plugin returning false will disable the calling of further
1013 * plugins.
1014 */
1015 default boolean modelGetterMethodGenerated(Method method,
1016 TopLevelClass topLevelClass, IntrospectedColumn introspectedColumn,
1017 IntrospectedTable introspectedTable, ModelClassType modelClassType) {
1018 return true;
1019 }
1020
1021 /**
1022 * This method is called after the setter, or mutator, method is generated
1023 * for a specific column in a table.
1024 *
1025 * @param method
1026 * the setter, or mutator, method generated for the specified
1027 * column
1028 * @param topLevelClass
1029 * the partially implemented model class. You can add additional
1030 * imported classes to the implementation class if necessary.
1031 * @param introspectedColumn
1032 * The class containing information about the column related
1033 * to this field as introspected from the database
1034 * @param introspectedTable
1035 * The class containing information about the table as
1036 * introspected from the database
1037 * @param modelClassType
1038 * the type of class that the field is generated for
1039 * @return true if the method should be generated, false if the generated
1040 * method should be ignored. In the case of multiple plugins, the
1041 * first plugin returning false will disable the calling of further
1042 * plugins.
1043 */
1044 default boolean modelSetterMethodGenerated(Method method,
1045 TopLevelClass topLevelClass, IntrospectedColumn introspectedColumn,
1046 IntrospectedTable introspectedTable, ModelClassType modelClassType) {
1047 return true;
1048 }
1049
1050 /**
1051 * This method is called after the primary key class is generated by the
1052 * ModelGenerator. This method will only be called if
1053 * the table rules call for generation of a primary key class.
1054 * <br><br>
1055 * This method is only guaranteed to be called by the Java
1056 * model generators. Other user supplied generators may, or may not, call
1057 * this method.
1058 *
1059 * @param topLevelClass
1060 * the generated primary key class
1061 * @param introspectedTable
1062 * The class containing information about the table as
1063 * introspected from the database
1064 * @return true if the class should be generated, false if the generated
1065 * class should be ignored. In the case of multiple plugins, the
1066 * first plugin returning false will disable the calling of further
1067 * plugins.
1068 */
1069 default boolean modelPrimaryKeyClassGenerated(TopLevelClass topLevelClass,
1070 IntrospectedTable introspectedTable) {
1071 return true;
1072 }
1073
1074 /**
1075 * This method is called after the base record class is generated by the
1076 * ModelGenerator. This method will only be called if
1077 * the table rules call for generation of a base record class.
1078 * <br><br>
1079 * This method is only guaranteed to be called by the default Java
1080 * model generators. Other user supplied generators may, or may not, call
1081 * this method.
1082 *
1083 * @param topLevelClass
1084 * the generated base record class
1085 * @param introspectedTable
1086 * The class containing information about the table as
1087 * introspected from the database
1088 * @return true if the class should be generated, false if the generated
1089 * class should be ignored. In the case of multiple plugins, the
1090 * first plugin returning false will disable the calling of further
1091 * plugins.
1092 */
1093 default boolean modelBaseRecordClassGenerated(TopLevelClass topLevelClass,
1094 IntrospectedTable introspectedTable) {
1095 return true;
1096 }
1097
1098 /**
1099 * This method is called after the record with BLOBs class is generated by
1100 * the ModelGenerator. This method will only be called
1101 * if the table rules call for generation of a record with BLOBs class.
1102 * <br><br>
1103 * This method is only guaranteed to be called by the default Java
1104 * model generators. Other user supplied generators may, or may not, call
1105 * this method.
1106 *
1107 * @param topLevelClass
1108 * the generated record with BLOBs class
1109 * @param introspectedTable
1110 * The class containing information about the table as
1111 * introspected from the database
1112 * @return true if the class should be generated, false if the generated
1113 * class should be ignored. In the case of multiple plugins, the
1114 * first plugin returning false will disable the calling of further
1115 * plugins.
1116 */
1117 default boolean modelRecordWithBLOBsClassGenerated(TopLevelClass topLevelClass,
1118 IntrospectedTable introspectedTable) {
1119 return true;
1120 }
1121
1122 /**
1123 * This method is called after the example class is generated by the
1124 * ModelGenerator. This method will only be called if the table
1125 * rules call for generation of an example class.
1126 * <br><br>
1127 * This method is only guaranteed to be called by the default Java
1128 * model generators. Other user supplied generators may, or may not, call
1129 * this method.
1130 *
1131 * @param topLevelClass
1132 * the generated example class
1133 * @param introspectedTable
1134 * The class containing information about the table as
1135 * introspected from the database
1136 * @return true if the class should be generated, false if the generated
1137 * class should be ignored. In the case of multiple plugins, the
1138 * first plugin returning false will disable the calling of further
1139 * plugins.
1140 */
1141 default boolean modelExampleClassGenerated(TopLevelClass topLevelClass,
1142 IntrospectedTable introspectedTable) {
1143 return true;
1144 }
1145
1146 /**
1147 * This method is called after a record class is generated (when the model type is "record")
1148 * The record is generated by the
1149 * ModelGenerator.
1150 * <br><br>
1151 * This method is only guaranteed to be called by the default Java
1152 * model generators. Other user supplied generators may, or may not, call
1153 * this method.
1154 *
1155 * @param topLevelRecord
1156 * the generated record
1157 * @param introspectedTable
1158 * The class containing information about the table as
1159 * introspected from the database
1160 * @return true if the record should be generated, false if the generated
1161 * record should be ignored. In the case of multiple plugins, the
1162 * first plugin returning false will disable the calling of further
1163 * plugins.
1164 */
1165 default boolean modelRecordGenerated(TopLevelRecord topLevelRecord, IntrospectedTable introspectedTable) {
1166 return true;
1167 }
1168
1169 /**
1170 * This method is called when the SqlMap file has been generated.
1171 *
1172 * @param sqlMap
1173 * the generated file (containing the file name, package name,
1174 * and project name)
1175 * @param introspectedTable
1176 * The class containing information about the table as
1177 * introspected from the database
1178 * @return true if the sqlMap should be generated, false if the generated
1179 * sqlMap should be ignored. In the case of multiple plugins, the
1180 * first plugin returning false will disable the calling of further
1181 * plugins.
1182 */
1183 default boolean sqlMapGenerated(GeneratedXmlFile sqlMap,
1184 IntrospectedTable introspectedTable) {
1185 return true;
1186 }
1187
1188 /**
1189 * This method is called when the SqlMap document has been generated. This
1190 * method can be used to add additional XML elements to the generated
1191 * document.
1192 *
1193 * @param document
1194 * the generated document (note that this is the MyBatis generator's internal
1195 * Document class - not the w3c XML Document class)
1196 * @param introspectedTable
1197 * The class containing information about the table as
1198 * introspected from the database
1199 * @return true if the document should be generated, false if the generated
1200 * document should be ignored. In the case of multiple plugins, the
1201 * first plugin returning false will disable the calling of further
1202 * plugins. Also, if any plugin returns false, then the
1203 * <code>sqlMapGenerated</code> method will not be called.
1204 */
1205 default boolean sqlMapDocumentGenerated(Document document, IntrospectedTable introspectedTable) {
1206 return true;
1207 }
1208
1209 /**
1210 * This method is called when the base resultMap is generated.
1211 *
1212 * @param element
1213 * the generated <resultMap> element
1214 * @param introspectedTable
1215 * The class containing information about the table as
1216 * introspected from the database
1217 * @return true if the element should be generated, false if the generated
1218 * element should be ignored. In the case of multiple plugins, the
1219 * first plugin returning false will disable the calling of further
1220 * plugins.
1221 */
1222 default boolean sqlMapResultMapWithoutBLOBsElementGenerated(XmlElement element,
1223 IntrospectedTable introspectedTable) {
1224 return true;
1225 }
1226
1227 /**
1228 * This method is called when the countByExample element is generated.
1229 *
1230 * @param element
1231 * the generated <select> element
1232 * @param introspectedTable
1233 * The class containing information about the table as
1234 * introspected from the database
1235 * @return true if the element should be generated, false if the generated
1236 * element should be ignored. In the case of multiple plugins, the
1237 * first plugin returning false will disable the calling of further
1238 * plugins.
1239 */
1240 default boolean sqlMapCountByExampleElementGenerated(XmlElement element,
1241 IntrospectedTable introspectedTable) {
1242 return true;
1243 }
1244
1245 /**
1246 * This method is called when the deleteByExample element is generated.
1247 *
1248 * @param element
1249 * the generated <delete> element
1250 * @param introspectedTable
1251 * The class containing information about the table as
1252 * introspected from the database
1253 * @return true if the element should be generated, false if the generated
1254 * element should be ignored. In the case of multiple plugins, the
1255 * first plugin returning false will disable the calling of further
1256 * plugins.
1257 */
1258 default boolean sqlMapDeleteByExampleElementGenerated(XmlElement element,
1259 IntrospectedTable introspectedTable) {
1260 return true;
1261 }
1262
1263 /**
1264 * This method is called when the deleteByPrimaryKey element is generated.
1265 *
1266 * @param element
1267 * the generated <delete> element
1268 * @param introspectedTable
1269 * The class containing information about the table as
1270 * introspected from the database
1271 * @return true if the element should be generated, false if the generated
1272 * element should be ignored. In the case of multiple plugins, the
1273 * first plugin returning false will disable the calling of further
1274 * plugins.
1275 */
1276 default boolean sqlMapDeleteByPrimaryKeyElementGenerated(XmlElement element,
1277 IntrospectedTable introspectedTable) {
1278 return true;
1279 }
1280
1281 /**
1282 * This method is called when the exampleWhereClause element is generated.
1283 *
1284 * @param element
1285 * the generated <sql> element
1286 * @param introspectedTable
1287 * The class containing information about the table as
1288 * introspected from the database
1289 * @return true if the element should be generated, false if the generated
1290 * element should be ignored. In the case of multiple plugins, the
1291 * first plugin returning false will disable the calling of further
1292 * plugins.
1293 */
1294 default boolean sqlMapExampleWhereClauseElementGenerated(XmlElement element,
1295 IntrospectedTable introspectedTable) {
1296 return true;
1297 }
1298
1299 /**
1300 * This method is called when the baseColumnList element is generated.
1301 *
1302 * @param element
1303 * the generated <sql> element
1304 * @param introspectedTable
1305 * The class containing information about the table as
1306 * introspected from the database
1307 * @return true if the element should be generated, false if the generated
1308 * element should be ignored. In the case of multiple plugins, the
1309 * first plugin returning false will disable the calling of further
1310 * plugins.
1311 */
1312 default boolean sqlMapBaseColumnListElementGenerated(XmlElement element,
1313 IntrospectedTable introspectedTable) {
1314 return true;
1315 }
1316
1317 /**
1318 * This method is called when the blobColumnList element is generated.
1319 *
1320 * @param element
1321 * the generated <sql> element
1322 * @param introspectedTable
1323 * The class containing information about the table as
1324 * introspected from the database
1325 * @return true if the element should be generated, false if the generated
1326 * element should be ignored. In the case of multiple plugins, the
1327 * first plugin returning false will disable the calling of further
1328 * plugins.
1329 */
1330 default boolean sqlMapBlobColumnListElementGenerated(XmlElement element,
1331 IntrospectedTable introspectedTable) {
1332 return true;
1333 }
1334
1335 /**
1336 * This method is called when the insert element is generated.
1337 *
1338 * @param element
1339 * the generated <insert> element
1340 * @param introspectedTable
1341 * The class containing information about the table as
1342 * introspected from the database
1343 * @return true if the element should be generated, false if the generated
1344 * element should be ignored. In the case of multiple plugins, the
1345 * first plugin returning false will disable the calling of further
1346 * plugins.
1347 */
1348 default boolean sqlMapInsertElementGenerated(XmlElement element,
1349 IntrospectedTable introspectedTable) {
1350 return true;
1351 }
1352
1353 /**
1354 * This method is called when the insert selective element is generated.
1355 *
1356 * @param element
1357 * the generated <insert> element
1358 * @param introspectedTable
1359 * The class containing information about the table as
1360 * introspected from the database
1361 * @return true if the element should be generated, false if the generated
1362 * element should be ignored. In the case of multiple plugins, the
1363 * first plugin returning false will disable the calling of further
1364 * plugins.
1365 */
1366 default boolean sqlMapInsertSelectiveElementGenerated(XmlElement element,
1367 IntrospectedTable introspectedTable) {
1368 return true;
1369 }
1370
1371 /**
1372 * This method is called when the resultMap with BLOBs element is generated
1373 * - this resultMap will extend the base resultMap.
1374 *
1375 * @param element
1376 * the generated <resultMap> element
1377 * @param introspectedTable
1378 * The class containing information about the table as
1379 * introspected from the database
1380 * @return true if the element should be generated, false if the generated
1381 * element should be ignored. In the case of multiple plugins, the
1382 * first plugin returning false will disable the calling of further
1383 * plugins.
1384 */
1385 default boolean sqlMapResultMapWithBLOBsElementGenerated(XmlElement element,
1386 IntrospectedTable introspectedTable) {
1387 return true;
1388 }
1389
1390 /**
1391 * This method is called when the selectAll element is generated.
1392 *
1393 * @param element
1394 * the generated <select> element
1395 * @param introspectedTable
1396 * The class containing information about the table as
1397 * introspected from the database
1398 * @return true if the element should be generated, false if the generated
1399 * element should be ignored. In the case of multiple plugins, the
1400 * first plugin returning false will disable the calling of further
1401 * plugins.
1402 */
1403 default boolean sqlMapSelectAllElementGenerated(XmlElement element,
1404 IntrospectedTable introspectedTable) {
1405 return true;
1406 }
1407
1408 /**
1409 * This method is called when the selectByPrimaryKey element is generated.
1410 *
1411 * @param element
1412 * the generated <select> element
1413 * @param introspectedTable
1414 * The class containing information about the table as
1415 * introspected from the database
1416 * @return true if the element should be generated, false if the generated
1417 * element should be ignored. In the case of multiple plugins, the
1418 * first plugin returning false will disable the calling of further
1419 * plugins.
1420 */
1421 default boolean sqlMapSelectByPrimaryKeyElementGenerated(XmlElement element,
1422 IntrospectedTable introspectedTable) {
1423 return true;
1424 }
1425
1426 /**
1427 * This method is called when the selectByExample element is generated.
1428 *
1429 * @param element
1430 * the generated <select> element
1431 * @param introspectedTable
1432 * The class containing information about the table as
1433 * introspected from the database
1434 * @return true if the element should be generated, false if the generated
1435 * element should be ignored. In the case of multiple plugins, the
1436 * first plugin returning false will disable the calling of further
1437 * plugins.
1438 */
1439 default boolean sqlMapSelectByExampleWithoutBLOBsElementGenerated(
1440 XmlElement element, IntrospectedTable introspectedTable) {
1441 return true;
1442 }
1443
1444 /**
1445 * This method is called when the selectByExampleWithBLOBs element is
1446 * generated.
1447 *
1448 * @param element
1449 * the generated <select> element
1450 * @param introspectedTable
1451 * The class containing information about the table as
1452 * introspected from the database
1453 * @return true if the element should be generated, false if the generated
1454 * element should be ignored. In the case of multiple plugins, the
1455 * first plugin returning false will disable the calling of further
1456 * plugins.
1457 */
1458 default boolean sqlMapSelectByExampleWithBLOBsElementGenerated(XmlElement element,
1459 IntrospectedTable introspectedTable) {
1460 return true;
1461 }
1462
1463 /**
1464 * This method is called when the updateByExampleSelective element is
1465 * generated.
1466 *
1467 * @param element
1468 * the generated <update> element
1469 * @param introspectedTable
1470 * The class containing information about the table as
1471 * introspected from the database
1472 * @return true if the element should be generated, false if the generated
1473 * element should be ignored. In the case of multiple plugins, the
1474 * first plugin returning false will disable the calling of further
1475 * plugins.
1476 */
1477 default boolean sqlMapUpdateByExampleSelectiveElementGenerated(XmlElement element,
1478 IntrospectedTable introspectedTable) {
1479 return true;
1480 }
1481
1482 /**
1483 * This method is called when the updateByExampleWithBLOBs element is
1484 * generated.
1485 *
1486 * @param element
1487 * the generated <update> element
1488 * @param introspectedTable
1489 * The class containing information about the table as
1490 * introspected from the database
1491 * @return true if the element should be generated, false if the generated
1492 * element should be ignored. In the case of multiple plugins, the
1493 * first plugin returning false will disable the calling of further
1494 * plugins.
1495 */
1496 default boolean sqlMapUpdateByExampleWithBLOBsElementGenerated(XmlElement element,
1497 IntrospectedTable introspectedTable) {
1498 return true;
1499 }
1500
1501 /**
1502 * This method is called when the updateByExampleWithourBLOBs element is
1503 * generated.
1504 *
1505 * @param element
1506 * the generated <update> element
1507 * @param introspectedTable
1508 * The class containing information about the table as
1509 * introspected from the database
1510 * @return true if the element should be generated, false if the generated
1511 * element should be ignored. In the case of multiple plugins, the
1512 * first plugin returning false will disable the calling of further
1513 * plugins.
1514 */
1515 default boolean sqlMapUpdateByExampleWithoutBLOBsElementGenerated(
1516 XmlElement element, IntrospectedTable introspectedTable) {
1517 return true;
1518 }
1519
1520 /**
1521 * This method is called when the updateByPrimaryKeySelective element is
1522 * generated.
1523 *
1524 * @param element
1525 * the generated <update> element
1526 * @param introspectedTable
1527 * The class containing information about the table as
1528 * introspected from the database
1529 * @return true if the element should be generated, false if the generated
1530 * element should be ignored. In the case of multiple plugins, the
1531 * first plugin returning false will disable the calling of further
1532 * plugins.
1533 */
1534 default boolean sqlMapUpdateByPrimaryKeySelectiveElementGenerated(
1535 XmlElement element, IntrospectedTable introspectedTable) {
1536 return true;
1537 }
1538
1539 /**
1540 * This method is called when the updateByPrimaryKeyWithBLOBs element is
1541 * generated.
1542 *
1543 * @param element
1544 * the generated <update> element
1545 * @param introspectedTable
1546 * The class containing information about the table as
1547 * introspected from the database
1548 * @return true if the element should be generated, false if the generated
1549 * element should be ignored. In the case of multiple plugins, the
1550 * first plugin returning false will disable the calling of further
1551 * plugins.
1552 */
1553 default boolean sqlMapUpdateByPrimaryKeyWithBLOBsElementGenerated(
1554 XmlElement element, IntrospectedTable introspectedTable) {
1555 return true;
1556 }
1557
1558 /**
1559 * This method is called when the updateByPrimaryKeyWithoutBLOBs element is
1560 * generated.
1561 *
1562 * @param element
1563 * the generated <update> element
1564 * @param introspectedTable
1565 * The class containing information about the table as
1566 * introspected from the database
1567 * @return true if the element should be generated, false if the generated
1568 * element should be ignored. In the case of multiple plugins, the
1569 * first plugin returning false will disable the calling of further
1570 * plugins.
1571 */
1572 default boolean sqlMapUpdateByPrimaryKeyWithoutBLOBsElementGenerated(
1573 XmlElement element, IntrospectedTable introspectedTable) {
1574 return true;
1575 }
1576
1577 /**
1578 * This method is called when the SQL provider has been generated.
1579 * Implement this method to add additional methods or fields to a generated
1580 * SQL provider.
1581 *
1582 * @param topLevelClass
1583 * the generated provider
1584 * @param introspectedTable
1585 * The class containing information about the table as
1586 * introspected from the database
1587 * @return true if the provider should be generated, false if the generated
1588 * provider should be ignored. In the case of multiple plugins, the
1589 * first plugin returning false will disable the calling of further
1590 * plugins.
1591 */
1592 default boolean providerGenerated(TopLevelClass topLevelClass,
1593 IntrospectedTable introspectedTable) {
1594 return true;
1595 }
1596
1597 /**
1598 * This method is called when the applyWhere method has
1599 * been generated in the SQL provider.
1600 *
1601 * @param method
1602 * the generated applyWhere method
1603 * @param topLevelClass
1604 * the partially generated provider class
1605 * You can add additional imported classes to the class
1606 * if necessary.
1607 * @param introspectedTable
1608 * The class containing information about the table as
1609 * introspected from the database
1610 * @return true if the method should be generated, false if the generated
1611 * method should be ignored. In the case of multiple plugins, the
1612 * first plugin returning false will disable the calling of further
1613 * plugins.
1614 */
1615 default boolean providerApplyWhereMethodGenerated(Method method,
1616 TopLevelClass topLevelClass, IntrospectedTable introspectedTable) {
1617 return true;
1618 }
1619
1620 /**
1621 * This method is called when the countByExample method has
1622 * been generated in the SQL provider.
1623 *
1624 * @param method
1625 * the generated countByExample method
1626 * @param topLevelClass
1627 * the partially generated provider class
1628 * You can add additional imported classes to the class
1629 * if necessary.
1630 * @param introspectedTable
1631 * The class containing information about the table as
1632 * introspected from the database
1633 * @return true if the method should be generated, false if the generated
1634 * method should be ignored. In the case of multiple plugins, the
1635 * first plugin returning false will disable the calling of further
1636 * plugins.
1637 */
1638 default boolean providerCountByExampleMethodGenerated(Method method,
1639 TopLevelClass topLevelClass, IntrospectedTable introspectedTable) {
1640 return true;
1641 }
1642
1643 /**
1644 * This method is called when the deleteByExample method has
1645 * been generated in the SQL provider.
1646 *
1647 * @param method
1648 * the generated deleteByExample method
1649 * @param topLevelClass
1650 * the partially generated provider class
1651 * You can add additional imported classes to the class
1652 * if necessary.
1653 * @param introspectedTable
1654 * The class containing information about the table as
1655 * introspected from the database
1656 * @return true if the method should be generated, false if the generated
1657 * method should be ignored. In the case of multiple plugins, the
1658 * first plugin returning false will disable the calling of further
1659 * plugins.
1660 */
1661 default boolean providerDeleteByExampleMethodGenerated(Method method,
1662 TopLevelClass topLevelClass, IntrospectedTable introspectedTable) {
1663 return true;
1664 }
1665
1666 /**
1667 * This method is called when the insertSelective method has
1668 * been generated in the SQL provider.
1669 *
1670 * @param method
1671 * the generated insertSelective method
1672 * @param topLevelClass
1673 * the partially generated provider class
1674 * You can add additional imported classes to the class
1675 * if necessary.
1676 * @param introspectedTable
1677 * The class containing information about the table as
1678 * introspected from the database
1679 * @return true if the method should be generated, false if the generated
1680 * method should be ignored. In the case of multiple plugins, the
1681 * first plugin returning false will disable the calling of further
1682 * plugins.
1683 */
1684 default boolean providerInsertSelectiveMethodGenerated(Method method,
1685 TopLevelClass topLevelClass, IntrospectedTable introspectedTable) {
1686 return true;
1687 }
1688
1689 /**
1690 * This method is called when the selectByExampleWithBLOBs method has
1691 * been generated in the SQL provider.
1692 *
1693 * @param method
1694 * the generated selectByExampleWithBLOBs method
1695 * @param topLevelClass
1696 * the partially generated provider class
1697 * You can add additional imported classes to the class
1698 * if necessary.
1699 * @param introspectedTable
1700 * The class containing information about the table as
1701 * introspected from the database
1702 * @return true if the method should be generated, false if the generated
1703 * method should be ignored. In the case of multiple plugins, the
1704 * first plugin returning false will disable the calling of further
1705 * plugins.
1706 */
1707 default boolean providerSelectByExampleWithBLOBsMethodGenerated(Method method,
1708 TopLevelClass topLevelClass, IntrospectedTable introspectedTable) {
1709 return true;
1710 }
1711
1712 /**
1713 * This method is called when the selectByExampleWithoutBLOBs method has
1714 * been generated in the SQL provider.
1715 *
1716 * @param method
1717 * the generated selectByExampleWithoutBLOBs method
1718 * @param topLevelClass
1719 * the partially generated provider class
1720 * You can add additional imported classes to the class
1721 * if necessary.
1722 * @param introspectedTable
1723 * The class containing information about the table as
1724 * introspected from the database
1725 * @return true if the method should be generated, false if the generated
1726 * method should be ignored. In the case of multiple plugins, the
1727 * first plugin returning false will disable the calling of further
1728 * plugins.
1729 */
1730 default boolean providerSelectByExampleWithoutBLOBsMethodGenerated(Method method,
1731 TopLevelClass topLevelClass, IntrospectedTable introspectedTable) {
1732 return true;
1733 }
1734
1735 /**
1736 * This method is called when the updateByExampleSelective method has
1737 * been generated in the SQL provider.
1738 *
1739 * @param method
1740 * the generated updateByExampleSelective method
1741 * @param topLevelClass
1742 * the partially generated provider class
1743 * You can add additional imported classes to the class
1744 * if necessary.
1745 * @param introspectedTable
1746 * The class containing information about the table as
1747 * introspected from the database
1748 * @return true if the method should be generated, false if the generated
1749 * method should be ignored. In the case of multiple plugins, the
1750 * first plugin returning false will disable the calling of further
1751 * plugins.
1752 */
1753 default boolean providerUpdateByExampleSelectiveMethodGenerated(Method method,
1754 TopLevelClass topLevelClass, IntrospectedTable introspectedTable) {
1755 return true;
1756 }
1757
1758 /**
1759 * This method is called when the updateByExampleWithBLOBs method has
1760 * been generated in the SQL provider.
1761 *
1762 * @param method
1763 * the generated updateByExampleWithBLOBs method
1764 * @param topLevelClass
1765 * the partially generated provider class
1766 * You can add additional imported classes to the class
1767 * if necessary.
1768 * @param introspectedTable
1769 * The class containing information about the table as
1770 * introspected from the database
1771 * @return true if the method should be generated, false if the generated
1772 * method should be ignored. In the case of multiple plugins, the
1773 * first plugin returning false will disable the calling of further
1774 * plugins.
1775 */
1776 default boolean providerUpdateByExampleWithBLOBsMethodGenerated(Method method,
1777 TopLevelClass topLevelClass, IntrospectedTable introspectedTable) {
1778 return true;
1779 }
1780
1781 /**
1782 * This method is called when the updateByExampleWithoutBLOBs method has
1783 * been generated in the SQL provider.
1784 *
1785 * @param method
1786 * the generated updateByExampleWithoutBLOBs method
1787 * @param topLevelClass
1788 * the partially generated provider class
1789 * You can add additional imported classes to the class
1790 * if necessary.
1791 * @param introspectedTable
1792 * The class containing information about the table as
1793 * introspected from the database
1794 * @return true if the method should be generated, false if the generated
1795 * method should be ignored. In the case of multiple plugins, the
1796 * first plugin returning false will disable the calling of further
1797 * plugins.
1798 */
1799 default boolean providerUpdateByExampleWithoutBLOBsMethodGenerated(Method method,
1800 TopLevelClass topLevelClass, IntrospectedTable introspectedTable) {
1801 return true;
1802 }
1803
1804 /**
1805 * This method is called when the updateByPrimaryKeySelective method has
1806 * been generated in the SQL provider.
1807 *
1808 * @param method
1809 * the generated updateByPrimaryKeySelective method
1810 * @param topLevelClass
1811 * the partially generated provider class
1812 * You can add additional imported classes to the class
1813 * if necessary.
1814 * @param introspectedTable
1815 * The class containing information about the table as
1816 * introspected from the database
1817 * @return true if the method should be generated, false if the generated
1818 * method should be ignored. In the case of multiple plugins, the
1819 * first plugin returning false will disable the calling of further
1820 * plugins.
1821 */
1822 default boolean providerUpdateByPrimaryKeySelectiveMethodGenerated(Method method,
1823 TopLevelClass topLevelClass, IntrospectedTable introspectedTable) {
1824 return true;
1825 }
1826
1827 /**
1828 * This method is called when the MyBatis Dynamic SQL support class has
1829 * been generated in the MyBatis Dynamic SQL runtime.
1830 *
1831 * @param supportClass
1832 * the generated MyBatis Dynamic SQL support class
1833 * You can add additional items to the generated class
1834 * if necessary.
1835 * @param introspectedTable
1836 * The class containing information about the table as
1837 * introspected from the database
1838 * @return true if the class should be generated, false if the generated
1839 * class should be ignored. In the case of multiple plugins, the
1840 * first plugin returning false will disable the calling of further
1841 * plugins.
1842 */
1843 default boolean dynamicSqlSupportGenerated(TopLevelClass supportClass, IntrospectedTable introspectedTable) {
1844 return true;
1845 }
1846
1847 /**
1848 * This method is called when the MyBatis Dynamic SQL support object has been generated. The format of the class
1849 * is an outer object with an inner class. The inner class contains the table and column definitions. The outer
1850 * (singleton) object contains a reference to an instance of the inner class, and shortcut properties that
1851 * reference the columns of that instance.
1852 *
1853 * @param kotlinFile the generated Kotlin file containing the outer object and inner class
1854 * @param outerSupportObject a reference to the outer object in the file
1855 * @param innerSupportClass a reference to the inner class
1856 * @param introspectedTable the class containing information about the table as
1857 * introspected from the database
1858 * @return true if the generated file should be kept
1859 */
1860 default boolean dynamicSqlSupportGenerated(KotlinFile kotlinFile, KotlinType outerSupportObject,
1861 KotlinType innerSupportClass, IntrospectedTable introspectedTable) {
1862 return true;
1863 }
1864
1865 default boolean mapperGenerated(KotlinFile mapperFile, KotlinType mapper, IntrospectedTable introspectedTable) {
1866 return true;
1867 }
1868
1869 default boolean kotlinDataClassGenerated(KotlinFile kotlinFile, KotlinType dataClass,
1870 IntrospectedTable introspectedTable) {
1871 return true;
1872 }
1873
1874 default boolean clientColumnListPropertyGenerated(KotlinProperty kotlinProperty, KotlinFile kotlinFile,
1875 IntrospectedTable introspectedTable) {
1876 return true;
1877 }
1878
1879 default boolean clientInsertMultipleVarargMethodGenerated(KotlinFunction kotlinFunction, KotlinFile kotlinFile,
1880 IntrospectedTable introspectedTable) {
1881 return true;
1882 }
1883
1884 default boolean clientUpdateByPrimaryKeyMethodGenerated(KotlinFunction kotlinFunction, KotlinFile kotlinFile,
1885 IntrospectedTable introspectedTable) {
1886 return true;
1887 }
1888
1889 /**
1890 * The motivation for adding this method can be found in
1891 * <a href="https://github.com/mybatis/generator/issues/1116">https://github.com/mybatis/generator/issues/1116</a>
1892 *
1893 * <p>This method is called when the updateByPrimaryKey method
1894 * has been generated in the dynamic SQL runtime client interface.
1895 *
1896 * @param method
1897 * the generated updateByPrimaryKey method
1898 * @param interfaze
1899 * the partially implemented client interface. You can add
1900 * additional imported classes to the interface if
1901 * necessary.
1902 * @param introspectedTable
1903 * The class containing information about the table as
1904 * introspected from the database
1905 * @return true if the method should be generated, false if the generated
1906 * method should be ignored. In the case of multiple plugins, the
1907 * first plugin returning false will disable the calling of further
1908 * plugins.
1909 */
1910 default boolean clientUpdateByPrimaryKeyMethodGenerated(Method method,
1911 Interface interfaze, IntrospectedTable introspectedTable) {
1912 return clientUpdateByPrimaryKeyWithBLOBsMethodGenerated(method, interfaze, introspectedTable);
1913 }
1914
1915 /**
1916 * If false, the table will be skipped in code generation.
1917 *
1918 * @param introspectedTable the current table
1919 * @return true if code should be generated for this table, else false
1920 */
1921 default boolean shouldGenerate(IntrospectedTable introspectedTable) {
1922 return true;
1923 }
1924 }