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