Java Code Examples for org.mybatis.generator.api.dom.java.FullyQualifiedJavaType#getShortName()
The following examples show how to use
org.mybatis.generator.api.dom.java.FullyQualifiedJavaType#getShortName() .
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: DynamicSqlSupportClassGenerator.java From mapper-generator-javafx with Apache License 2.0 | 6 votes |
private InnerClass buildInnerTableClass(TopLevelClass topLevelClass) { FullyQualifiedJavaType fqjt = new FullyQualifiedJavaType(introspectedTable.getFullyQualifiedTable().getDomainObjectName()); InnerClass innerClass = new InnerClass(fqjt.getShortName()); innerClass.setVisibility(JavaVisibility.PUBLIC); innerClass.setStatic(true); innerClass.setFinal(true); innerClass.setSuperClass(new FullyQualifiedJavaType("org.mybatis.dynamic.sql.SqlTable")); Method method = new Method(fqjt.getShortName()); method.setVisibility(JavaVisibility.PUBLIC); method.setConstructor(true); method.addBodyLine("super(\"" + escapeStringForJava(introspectedTable.getFullyQualifiedTableNameAtRuntime()) + "\");"); innerClass.addMethod(method); commentGenerator.addClassAnnotation(innerClass, introspectedTable, topLevelClass.getImportedTypes()); return innerClass; }
Example 2
Source File: SelectiveEnhancedPlugin.java From mybatis-generator-plugin with Apache License 2.0 | 6 votes |
/** * insertSelective 方法生成 * 具体执行顺序 http://www.mybatis.org/generator/reference/pluggingIn.html * @param method * @param interfaze * @param introspectedTable * @return */ @Override public boolean clientInsertSelectiveMethodGenerated(Method method, Interface interfaze, IntrospectedTable introspectedTable) { method.getParameters().clear(); FullyQualifiedJavaType parameterType = introspectedTable.getRules().calculateAllFieldsClass(); method.addParameter(new Parameter(parameterType, "record", "@Param(\"record\")")); // 找出全字段对应的Model FullyQualifiedJavaType fullFieldModel = introspectedTable.getRules().calculateAllFieldsClass(); // column枚举 FullyQualifiedJavaType selectiveType = new FullyQualifiedJavaType(fullFieldModel.getShortName() + "." + ModelColumnPlugin.ENUM_NAME); method.addParameter(new Parameter(selectiveType, "selective", "@Param(\"selective\")", true)); FormatTools.replaceGeneralMethodComment(commentGenerator, method, introspectedTable); return super.clientInsertSelectiveMethodGenerated(method, interfaze, introspectedTable); }
Example 3
Source File: SelectiveEnhancedPlugin.java From mybatis-generator-plugin with Apache License 2.0 | 6 votes |
/** * updateByExampleSelective * 具体执行顺序 http://www.mybatis.org/generator/reference/pluggingIn.html * @param method * @param interfaze * @param introspectedTable * @return */ @Override public boolean clientUpdateByExampleSelectiveMethodGenerated(Method method, Interface interfaze, IntrospectedTable introspectedTable) { method.getParameters().clear(); FullyQualifiedJavaType parameterType = introspectedTable.getRules().calculateAllFieldsClass(); method.addParameter(new Parameter(parameterType, "record", "@Param(\"record\")")); FullyQualifiedJavaType exampleType = new FullyQualifiedJavaType(introspectedTable.getExampleType()); method.addParameter(new Parameter(exampleType, "example", "@Param(\"example\")")); // 找出全字段对应的Model FullyQualifiedJavaType fullFieldModel = introspectedTable.getRules().calculateAllFieldsClass(); // column枚举 FullyQualifiedJavaType selectiveType = new FullyQualifiedJavaType(fullFieldModel.getShortName() + "." + ModelColumnPlugin.ENUM_NAME); method.addParameter(new Parameter(selectiveType, "selective", "@Param(\"selective\")", true)); FormatTools.replaceGeneralMethodComment(commentGenerator, method, introspectedTable); return super.clientUpdateByExampleSelectiveMethodGenerated(method, interfaze, introspectedTable); }
Example 4
Source File: DynamicSqlSupportClassGenerator.java From mybatis-generator-plugins with Apache License 2.0 | 6 votes |
private InnerClass buildInnerTableClass(TopLevelClass topLevelClass) { FullyQualifiedJavaType fqjt = new FullyQualifiedJavaType(sqlTableClassName); InnerClass innerClass = new InnerClass(fqjt.getShortName()); innerClass.setVisibility(JavaVisibility.PUBLIC); innerClass.setStatic(true); innerClass.setFinal(true); innerClass.setSuperClass(new FullyQualifiedJavaType("org.mybatis.dynamic.sql.SqlTable")); //$NON-NLS-1$ Method method = new Method(fqjt.getShortName()); method.setVisibility(JavaVisibility.PUBLIC); method.setConstructor(true); method.addBodyLine("super(\"" //$NON-NLS-1$ + escapeStringForJava(introspectedTable.getFullyQualifiedTableNameAtRuntime()) + "\");"); //$NON-NLS-1$ innerClass.addMethod(method); commentGenerator.addClassAnnotation(innerClass, introspectedTable, topLevelClass.getImportedTypes()); return innerClass; }
Example 5
Source File: SelectiveEnhancedPlugin.java From mybatis-generator-plugin with Apache License 2.0 | 5 votes |
/** * upsertSelective 方法 * @param method * @param interfaze * @param introspectedTable * @return */ @Override public boolean clientUpsertSelectiveMethodGenerated(Method method, Interface interfaze, IntrospectedTable introspectedTable) { // @Param("record") method.getParameters().get(0).addAnnotation("@Param(\"record\")"); // column枚举 // 找出全字段对应的Model FullyQualifiedJavaType fullFieldModel = introspectedTable.getRules().calculateAllFieldsClass(); FullyQualifiedJavaType selectiveType = new FullyQualifiedJavaType(fullFieldModel.getShortName() + "." + ModelColumnPlugin.ENUM_NAME); method.addParameter(new Parameter(selectiveType, "selective", "@Param(\"selective\")", true)); return true; }
Example 6
Source File: SelectiveEnhancedPlugin.java From mybatis-generator-plugin with Apache License 2.0 | 5 votes |
/** * upsertByExampleSelective 方法 * @param method * @param interfaze * @param introspectedTable * @return */ @Override public boolean clientUpsertByExampleSelectiveMethodGenerated(Method method, Interface interfaze, IntrospectedTable introspectedTable) { // column枚举 // 找出全字段对应的Model FullyQualifiedJavaType fullFieldModel = introspectedTable.getRules().calculateAllFieldsClass(); FullyQualifiedJavaType selectiveType = new FullyQualifiedJavaType(fullFieldModel.getShortName() + "." + ModelColumnPlugin.ENUM_NAME); method.addParameter(new Parameter(selectiveType, "selective", "@Param(\"selective\")", true)); return true; }
Example 7
Source File: SelectiveEnhancedPlugin.java From mybatis-generator-plugin with Apache License 2.0 | 5 votes |
@Override public boolean clientUpdateWithVersionByExampleSelectiveMethodGenerated(Method method, Interface interfaze, IntrospectedTable introspectedTable) { // issue#69 OptimisticLockerPlugin 插件updateWithVersionByExampleSelective方法的生成是基于updateByExampleSelective的, // 这个方法在配置了SelectiveEnhancedPlugin时可能已经被先配置的SelectiveEnhancedPlugin改变了 if (!"selective".equals(method.getParameters().get(method.getParameters().size() - 1).getName())) { // column枚举,找出全字段对应的Model FullyQualifiedJavaType fullFieldModel = introspectedTable.getRules().calculateAllFieldsClass(); FullyQualifiedJavaType selectiveType = new FullyQualifiedJavaType(fullFieldModel.getShortName() + "." + ModelColumnPlugin.ENUM_NAME); method.addParameter(new Parameter(selectiveType, "selective", "@Param(\"selective\")", true)); } return true; }
Example 8
Source File: SelectiveEnhancedPlugin.java From mybatis-generator-plugin with Apache License 2.0 | 5 votes |
@Override public boolean clientUpdateWithVersionByPrimaryKeySelectiveMethodGenerated(Method method, Interface interfaze, IntrospectedTable introspectedTable) { // issue#69 OptimisticLockerPlugin 插件updateWithVersionByExampleSelective方法的生成是基于updateByExampleSelective的, // 这个方法在配置了SelectiveEnhancedPlugin时可能已经被先配置的SelectiveEnhancedPlugin改变了 if (!"selective".equals(method.getParameters().get(method.getParameters().size() - 1).getName())) { // column枚举,找出全字段对应的Model FullyQualifiedJavaType fullFieldModel = introspectedTable.getRules().calculateAllFieldsClass(); FullyQualifiedJavaType selectiveType = new FullyQualifiedJavaType(fullFieldModel.getShortName() + "." + ModelColumnPlugin.ENUM_NAME); method.addParameter(new Parameter(selectiveType, "selective", "@Param(\"selective\")", true)); } return true; }