You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
current behavior:
targetRuntime determines what type of IntrospectedTable to create,
IntrospectedTable use generators to gen 'base' files.
eg. when targetRuntime = MyBatis3DynamicSql, IntrospectedTableMyBatis3DynamicSqlImpl
use DynamicSqlMapperGenerator, DynamicSqlSupportClassGenerator and DynamicSqlModelGenerator
to gen XxxModelMapperXxxModelDynamicSqlSupport and XxxModel
my idea is treat targetRuntime as an composite plugin
eg. when targetRuntime = MyBatis3DynamicSql mbg will use MyBatis3DynamicSqlCompositePlugn
to gen files, it actually use DynamicSqlMapperGeneratorPlugin, DynamicSqlSupportClassGeneratorPlugin and DynamicSqlModelGeneratorPlugin to gen files.
what's next?
IntrospectedTable no longer need methods such as calculateGenerators, getGeneratedJavaFiles...
IntrospectedTable only store table metadata, Plugins for generate various files.
The text was updated successfully, but these errors were encountered:
@ningpp thanks for the idea. I've had similar ideas too - that the basic generator engine should just drive plugins. And IntrospectedTable is an example of the God Object Anti-Pattern. The generator could certainly have a better architecture.
The problem is compatibility. I think making a change like this would break every plugin - and I think there are quite a lot of plugins in use. It would need to be done in a version 2.0 that would break backwards compatibility.
I started a rewrite some time ago, but ultimately abandoned it when I started work on MyBatis Dynamic SQL. I'm not sure when or if I will get back to that.
If you have thoughts about the difficulties of backwards compatibility, I'm interested to hear them.
what did i do?
step 1: new IntrospectedTable implementation(it generates nothing)
step 2: add some Plugins to generate model, mapper, xml, etc (they use the existing generators to gen files)
step 3: add some tests( Compare the generated files to see if they are the same as the original way)
current behavior:
targetRuntime determines what type of IntrospectedTable to create,
IntrospectedTable use generators to gen 'base' files.
eg. when
targetRuntime = MyBatis3DynamicSql
,IntrospectedTableMyBatis3DynamicSqlImpl
use
DynamicSqlMapperGenerator
,DynamicSqlSupportClassGenerator
andDynamicSqlModelGenerator
to gen
XxxModelMapper
XxxModelDynamicSqlSupport
andXxxModel
my idea is treat targetRuntime as an composite plugin
eg. when
targetRuntime = MyBatis3DynamicSql
mbg will useMyBatis3DynamicSqlCompositePlugn
to gen files, it actually use
DynamicSqlMapperGeneratorPlugin
,DynamicSqlSupportClassGeneratorPlugin
andDynamicSqlModelGeneratorPlugin
to gen files.what's next?
IntrospectedTable
no longer need methods such ascalculateGenerators
,getGeneratedJavaFiles
...IntrospectedTable
only store table metadata, Plugins for generate various files.The text was updated successfully, but these errors were encountered: