Java Code Examples for org.mybatis.generator.api.Plugin#modelGetterMethodGenerated()
The following examples show how to use
org.mybatis.generator.api.Plugin#modelGetterMethodGenerated() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PluginAggregator.java From mybatis-generator-core-fix with Apache License 2.0 | 6 votes |
public boolean modelGetterMethodGenerated(Method method, TopLevelClass topLevelClass, IntrospectedColumn introspectedColumn, IntrospectedTable introspectedTable, Plugin.ModelClassType modelClassType) { boolean rc = true; for (Plugin plugin : plugins) { if (!plugin.modelGetterMethodGenerated(method, topLevelClass, introspectedColumn, introspectedTable, modelClassType)) { rc = false; break; } } return rc; }
Example 2
Source File: PluginAggregator.java From mapper-generator-javafx with Apache License 2.0 | 6 votes |
@Override public boolean modelGetterMethodGenerated(Method method, TopLevelClass topLevelClass, IntrospectedColumn introspectedColumn, IntrospectedTable introspectedTable, Plugin.ModelClassType modelClassType) { boolean rc = true; for (Plugin plugin : plugins) { if (!plugin.modelGetterMethodGenerated(method, topLevelClass, introspectedColumn, introspectedTable, modelClassType)) { rc = false; break; } } return rc; }
Example 3
Source File: PluginAggregator.java From mybatis-generator-plus with Apache License 2.0 | 5 votes |
public boolean modelGetterMethodGenerated(Method method, TopLevelClass topLevelClass, IntrospectedColumn introspectedColumn, IntrospectedTable introspectedTable, Plugin.ModelClassType modelClassType) { boolean rc = true; for (Plugin plugin : plugins) { if (!plugin.modelGetterMethodGenerated(method, topLevelClass, introspectedColumn, introspectedTable, modelClassType)) { rc = false; break; } } return rc; }
Example 4
Source File: RecordWithBLOBsGenerator.java From mybatis-generator-core-fix with Apache License 2.0 | 4 votes |
@Override public List<CompilationUnit> getCompilationUnits() { FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable(); progressCallback.startTask(getString( "Progress.9", table.toString())); //$NON-NLS-1$ Plugin plugins = context.getPlugins(); CommentGenerator commentGenerator = context.getCommentGenerator(); TopLevelClass topLevelClass = new TopLevelClass(introspectedTable .getRecordWithBLOBsType()); topLevelClass.setVisibility(JavaVisibility.PUBLIC); commentGenerator.addJavaFileComment(topLevelClass); String rootClass = getRootClass(); if (introspectedTable.getRules().generateBaseRecordClass()) { topLevelClass.setSuperClass(introspectedTable.getBaseRecordType()); } else { topLevelClass.setSuperClass(introspectedTable.getPrimaryKeyType()); } commentGenerator.addModelClassComment(topLevelClass, introspectedTable); if (introspectedTable.isConstructorBased()) { addParameterizedConstructor(topLevelClass); if (!introspectedTable.isImmutable()) { addDefaultConstructor(topLevelClass); } } for (IntrospectedColumn introspectedColumn : introspectedTable .getBLOBColumns()) { if (RootClassInfo.getInstance(rootClass, warnings) .containsProperty(introspectedColumn)) { continue; } Field field = getJavaBeansField(introspectedColumn, context, introspectedTable); if (plugins.modelFieldGenerated(field, topLevelClass, introspectedColumn, introspectedTable, Plugin.ModelClassType.RECORD_WITH_BLOBS)) { topLevelClass.addField(field); topLevelClass.addImportedType(field.getType()); } Method method = getJavaBeansGetter(introspectedColumn, context, introspectedTable); if (plugins.modelGetterMethodGenerated(method, topLevelClass, introspectedColumn, introspectedTable, Plugin.ModelClassType.RECORD_WITH_BLOBS)) { topLevelClass.addMethod(method); } if (!introspectedTable.isImmutable()) { method = getJavaBeansSetter(introspectedColumn, context, introspectedTable); if (plugins.modelSetterMethodGenerated(method, topLevelClass, introspectedColumn, introspectedTable, Plugin.ModelClassType.RECORD_WITH_BLOBS)) { topLevelClass.addMethod(method); } } } List<CompilationUnit> answer = new ArrayList<CompilationUnit>(); if (context.getPlugins().modelRecordWithBLOBsClassGenerated( topLevelClass, introspectedTable)) { answer.add(topLevelClass); } return answer; }
Example 5
Source File: RecordWithBLOBsGenerator.java From mybatis-generator-plus with Apache License 2.0 | 4 votes |
@Override public List<CompilationUnit> getCompilationUnits() { FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable(); progressCallback.startTask(getString( "Progress.9", table.toString())); //$NON-NLS-1$ Plugin plugins = context.getPlugins(); CommentGenerator commentGenerator = context.getCommentGenerator(); TopLevelClass topLevelClass = new TopLevelClass(introspectedTable .getRecordWithBLOBsType()); topLevelClass.setVisibility(JavaVisibility.PUBLIC); commentGenerator.addJavaFileComment(topLevelClass); String rootClass = getRootClass(); if (introspectedTable.getRules().generateBaseRecordClass()) { topLevelClass.setSuperClass(introspectedTable.getBaseRecordType()); } else { topLevelClass.setSuperClass(introspectedTable.getPrimaryKeyType()); } if (introspectedTable.isConstructorBased()) { addParameterizedConstructor(topLevelClass); if (!introspectedTable.isImmutable()) { addDefaultConstructor(topLevelClass); } } for (IntrospectedColumn introspectedColumn : introspectedTable .getBLOBColumns()) { if (RootClassInfo.getInstance(rootClass, warnings) .containsProperty(introspectedColumn)) { continue; } Field field = getJavaBeansField(introspectedColumn); if (plugins.modelFieldGenerated(field, topLevelClass, introspectedColumn, introspectedTable, Plugin.ModelClassType.RECORD_WITH_BLOBS)) { topLevelClass.addField(field); topLevelClass.addImportedType(field.getType()); } Method method = getJavaBeansGetter(introspectedColumn); if (plugins.modelGetterMethodGenerated(method, topLevelClass, introspectedColumn, introspectedTable, Plugin.ModelClassType.RECORD_WITH_BLOBS)) { topLevelClass.addMethod(method); } if (!introspectedTable.isImmutable()) { method = getJavaBeansSetter(introspectedColumn); if (plugins.modelSetterMethodGenerated(method, topLevelClass, introspectedColumn, introspectedTable, Plugin.ModelClassType.RECORD_WITH_BLOBS)) { topLevelClass.addMethod(method); } } } List<CompilationUnit> answer = new ArrayList<CompilationUnit>(); if (context.getPlugins().modelRecordWithBLOBsClassGenerated( topLevelClass, introspectedTable)) { answer.add(topLevelClass); } return answer; }
Example 6
Source File: SimpleModelGenerator.java From mybatis-generator-plus with Apache License 2.0 | 4 votes |
@Override public List<CompilationUnit> getCompilationUnits() { FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable(); progressCallback.startTask(getString("Progress.8", table.toString())); //$NON-NLS-1$ Plugin plugins = context.getPlugins(); CommentGenerator commentGenerator = context.getCommentGenerator(); FullyQualifiedJavaType type = new FullyQualifiedJavaType( introspectedTable.getBaseRecordType()); TopLevelClass topLevelClass = new TopLevelClass(type); topLevelClass.setVisibility(JavaVisibility.PUBLIC); commentGenerator.addJavaFileComment(topLevelClass); FullyQualifiedJavaType superClass = getSuperClass(); if (superClass != null) { topLevelClass.setSuperClass(superClass); topLevelClass.addImportedType(superClass); } List<IntrospectedColumn> introspectedColumns = introspectedTable.getAllColumns(); if (introspectedTable.isConstructorBased()) { addParameterizedConstructor(topLevelClass); if (!introspectedTable.isImmutable()) { addDefaultConstructor(topLevelClass); } } String rootClass = getRootClass(); for (IntrospectedColumn introspectedColumn : introspectedColumns) { if (RootClassInfo.getInstance(rootClass, warnings) .containsProperty(introspectedColumn)) { continue; } Field field = getJavaBeansField(introspectedColumn); if (plugins.modelFieldGenerated(field, topLevelClass, introspectedColumn, introspectedTable, Plugin.ModelClassType.BASE_RECORD)) { topLevelClass.addField(field); topLevelClass.addImportedType(field.getType()); } Method method = getJavaBeansGetter(introspectedColumn); if (plugins.modelGetterMethodGenerated(method, topLevelClass, introspectedColumn, introspectedTable, Plugin.ModelClassType.BASE_RECORD)) { topLevelClass.addMethod(method); } if (!introspectedTable.isImmutable()) { method = getJavaBeansSetter(introspectedColumn); if (plugins.modelSetterMethodGenerated(method, topLevelClass, introspectedColumn, introspectedTable, Plugin.ModelClassType.BASE_RECORD)) { topLevelClass.addMethod(method); } } } List<CompilationUnit> answer = new ArrayList<CompilationUnit>(); if (context.getPlugins().modelBaseRecordClassGenerated(topLevelClass, introspectedTable)) { answer.add(topLevelClass); } return answer; }
Example 7
Source File: BaseRecordGenerator.java From mybatis-generator-plus with Apache License 2.0 | 4 votes |
@Override public List<CompilationUnit> getCompilationUnits() { FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable(); progressCallback.startTask(getString( "Progress.8", table.toString())); //$NON-NLS-1$ Plugin plugins = context.getPlugins(); CommentGenerator commentGenerator = context.getCommentGenerator(); FullyQualifiedJavaType type = new FullyQualifiedJavaType( introspectedTable.getBaseRecordType()); TopLevelClass topLevelClass = new TopLevelClass(type); topLevelClass.setVisibility(JavaVisibility.PUBLIC); commentGenerator.addJavaFileComment(topLevelClass); FullyQualifiedJavaType superClass = getSuperClass(); if (superClass != null) { topLevelClass.setSuperClass(superClass); topLevelClass.addImportedType(superClass); } List<IntrospectedColumn> introspectedColumns = getColumnsInThisClass(); if (introspectedTable.isConstructorBased()) { addParameterizedConstructor(topLevelClass); if (!introspectedTable.isImmutable()) { addDefaultConstructor(topLevelClass); } } String rootClass = getRootClass(); for (IntrospectedColumn introspectedColumn : introspectedColumns) { if (RootClassInfo.getInstance(rootClass, warnings) .containsProperty(introspectedColumn)) { continue; } Field field = getJavaBeansField(introspectedColumn); if (plugins.modelFieldGenerated(field, topLevelClass, introspectedColumn, introspectedTable, Plugin.ModelClassType.BASE_RECORD)) { topLevelClass.addField(field); topLevelClass.addImportedType(field.getType()); } Method method = getJavaBeansGetter(introspectedColumn); if (plugins.modelGetterMethodGenerated(method, topLevelClass, introspectedColumn, introspectedTable, Plugin.ModelClassType.BASE_RECORD)) { topLevelClass.addMethod(method); } if (!introspectedTable.isImmutable()) { method = getJavaBeansSetter(introspectedColumn); if (plugins.modelSetterMethodGenerated(method, topLevelClass, introspectedColumn, introspectedTable, Plugin.ModelClassType.BASE_RECORD)) { topLevelClass.addMethod(method); } } } List<CompilationUnit> answer = new ArrayList<CompilationUnit>(); if (context.getPlugins().modelBaseRecordClassGenerated( topLevelClass, introspectedTable)) { answer.add(topLevelClass); } return answer; }
Example 8
Source File: PrimaryKeyGenerator.java From mybatis-generator-plus with Apache License 2.0 | 4 votes |
@Override public List<CompilationUnit> getCompilationUnits() { FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable(); progressCallback.startTask(getString( "Progress.7", table.toString())); //$NON-NLS-1$ Plugin plugins = context.getPlugins(); CommentGenerator commentGenerator = context.getCommentGenerator(); TopLevelClass topLevelClass = new TopLevelClass(introspectedTable .getPrimaryKeyType()); topLevelClass.setVisibility(JavaVisibility.PUBLIC); commentGenerator.addJavaFileComment(topLevelClass); String rootClass = getRootClass(); if (rootClass != null) { topLevelClass.setSuperClass(new FullyQualifiedJavaType(rootClass)); topLevelClass.addImportedType(topLevelClass.getSuperClass()); } if (introspectedTable.isConstructorBased()) { addParameterizedConstructor(topLevelClass); if (!introspectedTable.isImmutable()) { addDefaultConstructor(topLevelClass); } } for (IntrospectedColumn introspectedColumn : introspectedTable .getPrimaryKeyColumns()) { if (RootClassInfo.getInstance(rootClass, warnings) .containsProperty(introspectedColumn)) { continue; } Field field = getJavaBeansField(introspectedColumn); if (plugins.modelFieldGenerated(field, topLevelClass, introspectedColumn, introspectedTable, Plugin.ModelClassType.PRIMARY_KEY)) { topLevelClass.addField(field); topLevelClass.addImportedType(field.getType()); } Method method = getJavaBeansGetter(introspectedColumn); if (plugins.modelGetterMethodGenerated(method, topLevelClass, introspectedColumn, introspectedTable, Plugin.ModelClassType.PRIMARY_KEY)) { topLevelClass.addMethod(method); } if (!introspectedTable.isImmutable()) { method = getJavaBeansSetter(introspectedColumn); if (plugins.modelSetterMethodGenerated(method, topLevelClass, introspectedColumn, introspectedTable, Plugin.ModelClassType.PRIMARY_KEY)) { topLevelClass.addMethod(method); } } } List<CompilationUnit> answer = new ArrayList<CompilationUnit>(); if (context.getPlugins().modelPrimaryKeyClassGenerated( topLevelClass, introspectedTable)) { answer.add(topLevelClass); } return answer; }
Example 9
Source File: RecordWithBLOBsGenerator.java From mybatis-generator-plus with Apache License 2.0 | 4 votes |
@Override public List<CompilationUnit> getCompilationUnits() { FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable(); progressCallback.startTask(getString( "Progress.9", table.toString())); //$NON-NLS-1$ Plugin plugins = context.getPlugins(); CommentGenerator commentGenerator = context.getCommentGenerator(); TopLevelClass topLevelClass = new TopLevelClass(introspectedTable .getRecordWithBLOBsType()); topLevelClass.setVisibility(JavaVisibility.PUBLIC); commentGenerator.addJavaFileComment(topLevelClass); if (introspectedTable.getRules().generateBaseRecordClass()) { topLevelClass.setSuperClass(introspectedTable.getBaseRecordType()); } else { topLevelClass.setSuperClass(introspectedTable.getPrimaryKeyType()); } String rootClass = getRootClass(); for (IntrospectedColumn introspectedColumn : introspectedTable .getBLOBColumns()) { if (RootClassInfo.getInstance(rootClass, warnings) .containsProperty(introspectedColumn)) { continue; } Field field = getJavaBeansField(introspectedColumn); if (plugins.modelFieldGenerated(field, topLevelClass, introspectedColumn, introspectedTable, Plugin.ModelClassType.RECORD_WITH_BLOBS)) { topLevelClass.addField(field); topLevelClass.addImportedType(field.getType()); } Method method = getJavaBeansGetter(introspectedColumn); if (plugins.modelGetterMethodGenerated(method, topLevelClass, introspectedColumn, introspectedTable, Plugin.ModelClassType.RECORD_WITH_BLOBS)) { topLevelClass.addMethod(method); } method = getJavaBeansSetter(introspectedColumn); if (plugins.modelSetterMethodGenerated(method, topLevelClass, introspectedColumn, introspectedTable, Plugin.ModelClassType.RECORD_WITH_BLOBS)) { topLevelClass.addMethod(method); } } List<CompilationUnit> answer = new ArrayList<CompilationUnit>(); if (context.getPlugins().modelRecordWithBLOBsClassGenerated( topLevelClass, introspectedTable)) { answer.add(topLevelClass); } return answer; }
Example 10
Source File: BaseRecordGenerator.java From mybatis-generator-plus with Apache License 2.0 | 4 votes |
@Override public List<CompilationUnit> getCompilationUnits() { FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable(); progressCallback.startTask(getString( "Progress.8", table.toString())); //$NON-NLS-1$ Plugin plugins = context.getPlugins(); CommentGenerator commentGenerator = context.getCommentGenerator(); TopLevelClass topLevelClass = new TopLevelClass(introspectedTable .getBaseRecordType()); topLevelClass.setVisibility(JavaVisibility.PUBLIC); commentGenerator.addJavaFileComment(topLevelClass); FullyQualifiedJavaType superClass = getSuperClass(); if (superClass != null) { topLevelClass.setSuperClass(superClass); topLevelClass.addImportedType(superClass); } List<IntrospectedColumn> introspectedColumns; if (includePrimaryKeyColumns()) { if (includeBLOBColumns()) { introspectedColumns = introspectedTable.getAllColumns(); } else { introspectedColumns = introspectedTable.getNonBLOBColumns(); } } else { if (includeBLOBColumns()) { introspectedColumns = introspectedTable .getNonPrimaryKeyColumns(); } else { introspectedColumns = introspectedTable.getBaseColumns(); } } String rootClass = getRootClass(); for (IntrospectedColumn introspectedColumn : introspectedColumns) { if (RootClassInfo.getInstance(rootClass, warnings) .containsProperty(introspectedColumn)) { continue; } Field field = getJavaBeansField(introspectedColumn); if (plugins.modelFieldGenerated(field, topLevelClass, introspectedColumn, introspectedTable, Plugin.ModelClassType.BASE_RECORD)) { topLevelClass.addField(field); topLevelClass.addImportedType(field.getType()); } Method method = getJavaBeansGetter(introspectedColumn); if (plugins.modelGetterMethodGenerated(method, topLevelClass, introspectedColumn, introspectedTable, Plugin.ModelClassType.BASE_RECORD)) { topLevelClass.addMethod(method); } method = getJavaBeansSetter(introspectedColumn); if (plugins.modelSetterMethodGenerated(method, topLevelClass, introspectedColumn, introspectedTable, Plugin.ModelClassType.BASE_RECORD)) { topLevelClass.addMethod(method); } } List<CompilationUnit> answer = new ArrayList<CompilationUnit>(); if (context.getPlugins().modelBaseRecordClassGenerated( topLevelClass, introspectedTable)) { answer.add(topLevelClass); } return answer; }
Example 11
Source File: PrimaryKeyGenerator.java From mybatis-generator-plus with Apache License 2.0 | 4 votes |
@Override public List<CompilationUnit> getCompilationUnits() { FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable(); progressCallback.startTask(getString( "Progress.7", table.toString())); //$NON-NLS-1$ Plugin plugins = context.getPlugins(); CommentGenerator commentGenerator = context.getCommentGenerator(); TopLevelClass topLevelClass = new TopLevelClass(introspectedTable .getPrimaryKeyType()); topLevelClass.setVisibility(JavaVisibility.PUBLIC); commentGenerator.addJavaFileComment(topLevelClass); String rootClass = getRootClass(); if (rootClass != null) { topLevelClass.setSuperClass(new FullyQualifiedJavaType(rootClass)); topLevelClass.addImportedType(topLevelClass.getSuperClass()); } for (IntrospectedColumn introspectedColumn : introspectedTable .getPrimaryKeyColumns()) { if (RootClassInfo.getInstance(rootClass, warnings) .containsProperty(introspectedColumn)) { continue; } Field field = getJavaBeansField(introspectedColumn); if (plugins.modelFieldGenerated(field, topLevelClass, introspectedColumn, introspectedTable, Plugin.ModelClassType.PRIMARY_KEY)) { topLevelClass.addField(field); topLevelClass.addImportedType(field.getType()); } Method method = getJavaBeansGetter(introspectedColumn); if (plugins.modelGetterMethodGenerated(method, topLevelClass, introspectedColumn, introspectedTable, Plugin.ModelClassType.PRIMARY_KEY)) { topLevelClass.addMethod(method); } method = getJavaBeansSetter(introspectedColumn); if (plugins.modelSetterMethodGenerated(method, topLevelClass, introspectedColumn, introspectedTable, Plugin.ModelClassType.PRIMARY_KEY)) { topLevelClass.addMethod(method); } } List<CompilationUnit> answer = new ArrayList<CompilationUnit>(); if (context.getPlugins().modelPrimaryKeyClassGenerated( topLevelClass, introspectedTable)) { answer.add(topLevelClass); } return answer; }
Example 12
Source File: SimpleModelGenerator.java From mybatis-generator-core-fix with Apache License 2.0 | 4 votes |
@Override public List<CompilationUnit> getCompilationUnits() { FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable(); progressCallback.startTask(getString("Progress.8", table.toString())); //$NON-NLS-1$ Plugin plugins = context.getPlugins(); CommentGenerator commentGenerator = context.getCommentGenerator(); FullyQualifiedJavaType type = new FullyQualifiedJavaType( introspectedTable.getBaseRecordType()); TopLevelClass topLevelClass = new TopLevelClass(type); topLevelClass.setVisibility(JavaVisibility.PUBLIC); commentGenerator.addJavaFileComment(topLevelClass); FullyQualifiedJavaType superClass = getSuperClass(); if (superClass != null) { topLevelClass.setSuperClass(superClass); topLevelClass.addImportedType(superClass); } commentGenerator.addModelClassComment(topLevelClass, introspectedTable); List<IntrospectedColumn> introspectedColumns = introspectedTable.getAllColumns(); if (introspectedTable.isConstructorBased()) { addParameterizedConstructor(topLevelClass); if (!introspectedTable.isImmutable()) { addDefaultConstructor(topLevelClass); } } String rootClass = getRootClass(); for (IntrospectedColumn introspectedColumn : introspectedColumns) { if (RootClassInfo.getInstance(rootClass, warnings) .containsProperty(introspectedColumn)) { continue; } Field field = getJavaBeansField(introspectedColumn, context, introspectedTable); if (plugins.modelFieldGenerated(field, topLevelClass, introspectedColumn, introspectedTable, Plugin.ModelClassType.BASE_RECORD)) { topLevelClass.addField(field); topLevelClass.addImportedType(field.getType()); } Method method = getJavaBeansGetter(introspectedColumn, context, introspectedTable); if (plugins.modelGetterMethodGenerated(method, topLevelClass, introspectedColumn, introspectedTable, Plugin.ModelClassType.BASE_RECORD)) { topLevelClass.addMethod(method); } if (!introspectedTable.isImmutable()) { method = getJavaBeansSetter(introspectedColumn, context, introspectedTable); if (plugins.modelSetterMethodGenerated(method, topLevelClass, introspectedColumn, introspectedTable, Plugin.ModelClassType.BASE_RECORD)) { topLevelClass.addMethod(method); } } } List<CompilationUnit> answer = new ArrayList<CompilationUnit>(); if (context.getPlugins().modelBaseRecordClassGenerated(topLevelClass, introspectedTable)) { answer.add(topLevelClass); } return answer; }
Example 13
Source File: BaseRecordGenerator.java From mybatis-generator-core-fix with Apache License 2.0 | 4 votes |
@Override public List<CompilationUnit> getCompilationUnits() { FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable(); progressCallback.startTask(getString( "Progress.8", table.toString())); //$NON-NLS-1$ Plugin plugins = context.getPlugins(); CommentGenerator commentGenerator = context.getCommentGenerator(); FullyQualifiedJavaType type = new FullyQualifiedJavaType( introspectedTable.getBaseRecordType()); TopLevelClass topLevelClass = new TopLevelClass(type); topLevelClass.setVisibility(JavaVisibility.PUBLIC); commentGenerator.addJavaFileComment(topLevelClass); commentGenerator.addClassComment(topLevelClass, introspectedTable); FullyQualifiedJavaType superClass = getSuperClass(); if (superClass != null) { topLevelClass.setSuperClass(superClass); topLevelClass.addImportedType(superClass); } commentGenerator.addModelClassComment(topLevelClass, introspectedTable); List<IntrospectedColumn> introspectedColumns = getColumnsInThisClass(); if (introspectedTable.isConstructorBased()) { addParameterizedConstructor(topLevelClass); if (!introspectedTable.isImmutable()) { addDefaultConstructor(topLevelClass); } } String rootClass = getRootClass(); for (IntrospectedColumn introspectedColumn : introspectedColumns) { if (RootClassInfo.getInstance(rootClass, warnings) .containsProperty(introspectedColumn)) { continue; } Field field = getJavaBeansField(introspectedColumn, context, introspectedTable); if (plugins.modelFieldGenerated(field, topLevelClass, introspectedColumn, introspectedTable, Plugin.ModelClassType.BASE_RECORD)) { topLevelClass.addField(field); topLevelClass.addImportedType(field.getType()); } Method method = getJavaBeansGetter(introspectedColumn, context, introspectedTable); if (plugins.modelGetterMethodGenerated(method, topLevelClass, introspectedColumn, introspectedTable, Plugin.ModelClassType.BASE_RECORD)) { topLevelClass.addMethod(method); } if (!introspectedTable.isImmutable()) { method = getJavaBeansSetter(introspectedColumn, context, introspectedTable); if (plugins.modelSetterMethodGenerated(method, topLevelClass, introspectedColumn, introspectedTable, Plugin.ModelClassType.BASE_RECORD)) { topLevelClass.addMethod(method); } } } List<CompilationUnit> answer = new ArrayList<CompilationUnit>(); if (context.getPlugins().modelBaseRecordClassGenerated( topLevelClass, introspectedTable)) { answer.add(topLevelClass); } return answer; }
Example 14
Source File: PrimaryKeyGenerator.java From mybatis-generator-core-fix with Apache License 2.0 | 4 votes |
@Override public List<CompilationUnit> getCompilationUnits() { FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable(); progressCallback.startTask(getString( "Progress.7", table.toString())); //$NON-NLS-1$ Plugin plugins = context.getPlugins(); CommentGenerator commentGenerator = context.getCommentGenerator(); TopLevelClass topLevelClass = new TopLevelClass(introspectedTable .getPrimaryKeyType()); topLevelClass.setVisibility(JavaVisibility.PUBLIC); commentGenerator.addJavaFileComment(topLevelClass); String rootClass = getRootClass(); if (rootClass != null) { topLevelClass.setSuperClass(new FullyQualifiedJavaType(rootClass)); topLevelClass.addImportedType(topLevelClass.getSuperClass()); } if (introspectedTable.isConstructorBased()) { addParameterizedConstructor(topLevelClass); if (!introspectedTable.isImmutable()) { addDefaultConstructor(topLevelClass); } } commentGenerator.addModelClassComment(topLevelClass, introspectedTable); for (IntrospectedColumn introspectedColumn : introspectedTable .getPrimaryKeyColumns()) { if (RootClassInfo.getInstance(rootClass, warnings) .containsProperty(introspectedColumn)) { continue; } Field field = getJavaBeansField(introspectedColumn, context, introspectedTable); if (plugins.modelFieldGenerated(field, topLevelClass, introspectedColumn, introspectedTable, Plugin.ModelClassType.PRIMARY_KEY)) { topLevelClass.addField(field); topLevelClass.addImportedType(field.getType()); } Method method = getJavaBeansGetter(introspectedColumn, context, introspectedTable); if (plugins.modelGetterMethodGenerated(method, topLevelClass, introspectedColumn, introspectedTable, Plugin.ModelClassType.PRIMARY_KEY)) { topLevelClass.addMethod(method); } if (!introspectedTable.isImmutable()) { method = getJavaBeansSetter(introspectedColumn, context, introspectedTable); if (plugins.modelSetterMethodGenerated(method, topLevelClass, introspectedColumn, introspectedTable, Plugin.ModelClassType.PRIMARY_KEY)) { topLevelClass.addMethod(method); } } } List<CompilationUnit> answer = new ArrayList<CompilationUnit>(); if (context.getPlugins().modelPrimaryKeyClassGenerated( topLevelClass, introspectedTable)) { answer.add(topLevelClass); } return answer; }
Example 15
Source File: RecordWithBLOBsGenerator.java From mybatis-generator-core-fix with Apache License 2.0 | 4 votes |
@Override public List<CompilationUnit> getCompilationUnits() { FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable(); progressCallback.startTask(getString( "Progress.9", table.toString())); //$NON-NLS-1$ Plugin plugins = context.getPlugins(); CommentGenerator commentGenerator = context.getCommentGenerator(); TopLevelClass topLevelClass = new TopLevelClass(introspectedTable .getRecordWithBLOBsType()); topLevelClass.setVisibility(JavaVisibility.PUBLIC); commentGenerator.addJavaFileComment(topLevelClass); if (introspectedTable.getRules().generateBaseRecordClass()) { topLevelClass.setSuperClass(introspectedTable.getBaseRecordType()); } else { topLevelClass.setSuperClass(introspectedTable.getPrimaryKeyType()); } String rootClass = getRootClass(); for (IntrospectedColumn introspectedColumn : introspectedTable .getBLOBColumns()) { if (RootClassInfo.getInstance(rootClass, warnings) .containsProperty(introspectedColumn)) { continue; } Field field = getJavaBeansField(introspectedColumn, context, introspectedTable); if (plugins.modelFieldGenerated(field, topLevelClass, introspectedColumn, introspectedTable, Plugin.ModelClassType.RECORD_WITH_BLOBS)) { topLevelClass.addField(field); topLevelClass.addImportedType(field.getType()); } Method method = getJavaBeansGetter(introspectedColumn, context, introspectedTable); if (plugins.modelGetterMethodGenerated(method, topLevelClass, introspectedColumn, introspectedTable, Plugin.ModelClassType.RECORD_WITH_BLOBS)) { topLevelClass.addMethod(method); } method = getJavaBeansSetter(introspectedColumn, context, introspectedTable); if (plugins.modelSetterMethodGenerated(method, topLevelClass, introspectedColumn, introspectedTable, Plugin.ModelClassType.RECORD_WITH_BLOBS)) { topLevelClass.addMethod(method); } } List<CompilationUnit> answer = new ArrayList<CompilationUnit>(); if (context.getPlugins().modelRecordWithBLOBsClassGenerated( topLevelClass, introspectedTable)) { answer.add(topLevelClass); } return answer; }
Example 16
Source File: BaseRecordGenerator.java From mybatis-generator-core-fix with Apache License 2.0 | 4 votes |
@Override public List<CompilationUnit> getCompilationUnits() { FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable(); progressCallback.startTask(getString( "Progress.8", table.toString())); //$NON-NLS-1$ Plugin plugins = context.getPlugins(); CommentGenerator commentGenerator = context.getCommentGenerator(); TopLevelClass topLevelClass = new TopLevelClass(introspectedTable .getBaseRecordType()); topLevelClass.setVisibility(JavaVisibility.PUBLIC); commentGenerator.addJavaFileComment(topLevelClass); FullyQualifiedJavaType superClass = getSuperClass(); if (superClass != null) { topLevelClass.setSuperClass(superClass); topLevelClass.addImportedType(superClass); } List<IntrospectedColumn> introspectedColumns; if (includePrimaryKeyColumns()) { if (includeBLOBColumns()) { introspectedColumns = introspectedTable.getAllColumns(); } else { introspectedColumns = introspectedTable.getNonBLOBColumns(); } } else { if (includeBLOBColumns()) { introspectedColumns = introspectedTable .getNonPrimaryKeyColumns(); } else { introspectedColumns = introspectedTable.getBaseColumns(); } } String rootClass = getRootClass(); for (IntrospectedColumn introspectedColumn : introspectedColumns) { if (RootClassInfo.getInstance(rootClass, warnings) .containsProperty(introspectedColumn)) { continue; } Field field = getJavaBeansField(introspectedColumn, context, introspectedTable); if (plugins.modelFieldGenerated(field, topLevelClass, introspectedColumn, introspectedTable, Plugin.ModelClassType.BASE_RECORD)) { topLevelClass.addField(field); topLevelClass.addImportedType(field.getType()); } Method method = getJavaBeansGetter(introspectedColumn, context, introspectedTable); if (plugins.modelGetterMethodGenerated(method, topLevelClass, introspectedColumn, introspectedTable, Plugin.ModelClassType.BASE_RECORD)) { topLevelClass.addMethod(method); } method = getJavaBeansSetter(introspectedColumn, context, introspectedTable); if (plugins.modelSetterMethodGenerated(method, topLevelClass, introspectedColumn, introspectedTable, Plugin.ModelClassType.BASE_RECORD)) { topLevelClass.addMethod(method); } } List<CompilationUnit> answer = new ArrayList<CompilationUnit>(); if (context.getPlugins().modelBaseRecordClassGenerated( topLevelClass, introspectedTable)) { answer.add(topLevelClass); } return answer; }
Example 17
Source File: PrimaryKeyGenerator.java From mybatis-generator-core-fix with Apache License 2.0 | 4 votes |
@Override public List<CompilationUnit> getCompilationUnits() { FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable(); progressCallback.startTask(getString( "Progress.7", table.toString())); //$NON-NLS-1$ Plugin plugins = context.getPlugins(); CommentGenerator commentGenerator = context.getCommentGenerator(); TopLevelClass topLevelClass = new TopLevelClass(introspectedTable .getPrimaryKeyType()); topLevelClass.setVisibility(JavaVisibility.PUBLIC); commentGenerator.addJavaFileComment(topLevelClass); String rootClass = getRootClass(); if (rootClass != null) { topLevelClass.setSuperClass(new FullyQualifiedJavaType(rootClass)); topLevelClass.addImportedType(topLevelClass.getSuperClass()); } for (IntrospectedColumn introspectedColumn : introspectedTable .getPrimaryKeyColumns()) { if (RootClassInfo.getInstance(rootClass, warnings) .containsProperty(introspectedColumn)) { continue; } Field field = getJavaBeansField(introspectedColumn, context, introspectedTable); if (plugins.modelFieldGenerated(field, topLevelClass, introspectedColumn, introspectedTable, Plugin.ModelClassType.PRIMARY_KEY)) { topLevelClass.addField(field); topLevelClass.addImportedType(field.getType()); } Method method = getJavaBeansGetter(introspectedColumn, context, introspectedTable); if (plugins.modelGetterMethodGenerated(method, topLevelClass, introspectedColumn, introspectedTable, Plugin.ModelClassType.PRIMARY_KEY)) { topLevelClass.addMethod(method); } method = getJavaBeansSetter(introspectedColumn, context, introspectedTable); if (plugins.modelSetterMethodGenerated(method, topLevelClass, introspectedColumn, introspectedTable, Plugin.ModelClassType.PRIMARY_KEY)) { topLevelClass.addMethod(method); } } List<CompilationUnit> answer = new ArrayList<CompilationUnit>(); if (context.getPlugins().modelPrimaryKeyClassGenerated( topLevelClass, introspectedTable)) { answer.add(topLevelClass); } return answer; }
Example 18
Source File: DynamicSqlModelGenerator.java From mapper-generator-javafx with Apache License 2.0 | 4 votes |
@Override public List<CompilationUnit> getCompilationUnits() { FullyQualifiedTable table = introspectedTable.getFullyQualifiedTable(); progressCallback.startTask(getString("Progress.8", table.toString())); Plugin plugins = context.getPlugins(); CommentGenerator commentGenerator = context.getCommentGenerator(); FullyQualifiedJavaType type = new FullyQualifiedJavaType(introspectedTable.getBaseRecordType()); TopLevelClass topLevelClass = new TopLevelClass(type); topLevelClass.setVisibility(JavaVisibility.PUBLIC); commentGenerator.addJavaFileComment(topLevelClass); FullyQualifiedJavaType superClass = getSuperClass(); if (superClass != null) { topLevelClass.setSuperClass(superClass); topLevelClass.addImportedType(superClass); } commentGenerator.addModelClassComment(topLevelClass, introspectedTable); List<IntrospectedColumn> introspectedColumns = introspectedTable.getAllColumns(); if (introspectedTable.isConstructorBased()) { addParameterizedConstructor(topLevelClass); if (!introspectedTable.isImmutable()) { addDefaultConstructorWithGeneratedAnnotatoin(topLevelClass); } } String rootClass = getRootClass(); for (IntrospectedColumn introspectedColumn : introspectedColumns) { if (RootClassInfo.getInstance(rootClass, warnings).containsProperty(introspectedColumn)) { continue; } Field field = getJavaBeansFieldWithGeneratedAnnotation(introspectedColumn, context, introspectedTable, topLevelClass); if (plugins.modelFieldGenerated(field, topLevelClass, introspectedColumn, introspectedTable, Plugin.ModelClassType.BASE_RECORD)) { topLevelClass.addField(field); topLevelClass.addImportedType(field.getType()); } Method method = getJavaBeansGetterWithGeneratedAnnotation(introspectedColumn, context, introspectedTable, topLevelClass); if (plugins.modelGetterMethodGenerated(method, topLevelClass, introspectedColumn, introspectedTable, Plugin.ModelClassType.BASE_RECORD)) { topLevelClass.addMethod(method); } if (!introspectedTable.isImmutable()) { method = getJavaBeansSetterWithGeneratedAnnotation(introspectedColumn, context, introspectedTable, topLevelClass); if (plugins.modelSetterMethodGenerated(method, topLevelClass, introspectedColumn, introspectedTable, Plugin.ModelClassType.BASE_RECORD)) { topLevelClass.addMethod(method); } } } List<CompilationUnit> answer = new ArrayList<>(); if (context.getPlugins().modelBaseRecordClassGenerated(topLevelClass, introspectedTable)) { answer.add(topLevelClass); } return answer; }