org.mybatis.generator.api.IntrospectedTable.TargetRuntime Java Examples
The following examples show how to use
org.mybatis.generator.api.IntrospectedTable.TargetRuntime.
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: BaseRules.java From mybatis-generator-plus with Apache License 2.0 | 6 votes |
/** * Implements the rule for generating the SQL example where clause element. * * In iBATIS2, generate the element if the selectByExample, deleteByExample, * updateByExample, or countByExample statements are allowed. * * In MyBatis3, generate the element if the selectByExample, * deleteByExample, or countByExample statements are allowed. * * @return true if the SQL where clause element should be generated */ public boolean generateSQLExampleWhereClause() { if (isModelOnly) { return false; } boolean rc = tableConfiguration.isSelectByExampleStatementEnabled() || tableConfiguration.isDeleteByExampleStatementEnabled() || tableConfiguration.isCountByExampleStatementEnabled(); if (introspectedTable.getTargetRuntime() == TargetRuntime.IBATIS2) { rc |= tableConfiguration.isUpdateByExampleStatementEnabled(); } return rc; }
Example #2
Source File: CustomSettingsPlugin.java From BlogManagePlatform with Apache License 2.0 | 6 votes |
/** * 配置序列化 * @author Frodez * @date 2019-01-13 */ private void makeSerializable(TopLevelClass klass, IntrospectedTable table) { klass.addImportedType(new FullyQualifiedJavaType("java.io.Serializable")); klass.addSuperInterface(new FullyQualifiedJavaType("java.io.Serializable")); Field field = new Field("serialVersionUID", new FullyQualifiedJavaType("long")); field.setFinal(true); field.setInitializationString("1L"); field.addJavaDocLine(""); field.setStatic(true); field.setVisibility(JavaVisibility.PRIVATE); if (table.getTargetRuntime() == TargetRuntime.MYBATIS3_DSQL) { context.getCommentGenerator().addFieldAnnotation(field, table, klass.getImportedTypes()); } else { context.getCommentGenerator().addFieldComment(field, table); } klass.getFields().add(0, field); }
Example #3
Source File: BaseRules.java From mybatis-generator-core-fix with Apache License 2.0 | 6 votes |
/** * Implements the rule for generating the SQL example where clause element. * * In iBATIS2, generate the element if the selectByExample, deleteByExample, * updateByExample, or countByExample statements are allowed. * * In MyBatis3, generate the element if the selectByExample, * deleteByExample, or countByExample statements are allowed. * * @return true if the SQL where clause element should be generated */ public boolean generateSQLExampleWhereClause() { if (isModelOnly) { return false; } boolean rc = tableConfiguration.isSelectByExampleStatementEnabled() || tableConfiguration.isDeleteByExampleStatementEnabled() || tableConfiguration.isCountByExampleStatementEnabled(); if (introspectedTable.getTargetRuntime() == TargetRuntime.IBATIS2) { rc |= tableConfiguration.isUpdateByExampleStatementEnabled(); } return rc; }
Example #4
Source File: RowBoundsPlugin.java From mapper-generator-javafx with Apache License 2.0 | 5 votes |
@Override public boolean clientSelectByExampleWithBLOBsMethodGenerated(Method method, Interface interfaze, IntrospectedTable introspectedTable) { if (introspectedTable.getTargetRuntime() == TargetRuntime.MYBATIS3) { copyAndAddMethod(method, interfaze); } else if (introspectedTable.getTargetRuntime() == TargetRuntime.MYBATIS3_DSQL) { copyAndAddSelectByExampleMethodForDSQL(method, interfaze); } return true; }
Example #5
Source File: RowBoundsPlugin.java From mybatis-generator-plus with Apache License 2.0 | 5 votes |
@Override public boolean sqlMapSelectByExampleWithBLOBsElementGenerated( XmlElement element, IntrospectedTable introspectedTable) { if (introspectedTable.getTargetRuntime() == TargetRuntime.MYBATIS3) { copyAndSaveElement(element, introspectedTable.getFullyQualifiedTable()); } return true; }
Example #6
Source File: RowBoundsPlugin.java From mybatis-generator-plus with Apache License 2.0 | 5 votes |
@Override public boolean sqlMapSelectByExampleWithoutBLOBsElementGenerated( XmlElement element, IntrospectedTable introspectedTable) { if (introspectedTable.getTargetRuntime() == TargetRuntime.MYBATIS3) { copyAndSaveElement(element, introspectedTable.getFullyQualifiedTable()); } return true; }
Example #7
Source File: RowBoundsPlugin.java From mybatis-generator-plus with Apache License 2.0 | 5 votes |
@Override public boolean clientSelectByExampleWithoutBLOBsMethodGenerated( Method method, Interface interfaze, IntrospectedTable introspectedTable) { if (introspectedTable.getTargetRuntime() == TargetRuntime.MYBATIS3) { copyAndAddMethod(method, interfaze); } return true; }
Example #8
Source File: RowBoundsPlugin.java From mybatis-generator-plus with Apache License 2.0 | 5 votes |
@Override public boolean clientSelectByExampleWithBLOBsMethodGenerated(Method method, Interface interfaze, IntrospectedTable introspectedTable) { if (introspectedTable.getTargetRuntime() == TargetRuntime.MYBATIS3) { copyAndAddMethod(method, interfaze); } return true; }
Example #9
Source File: RowBoundsPlugin.java From mybatis-generator-core-fix with Apache License 2.0 | 5 votes |
@Override public boolean sqlMapSelectByExampleWithBLOBsElementGenerated( XmlElement element, IntrospectedTable introspectedTable) { if (introspectedTable.getTargetRuntime() == TargetRuntime.MYBATIS3) { copyAndSaveElement(element, introspectedTable.getFullyQualifiedTable()); } return true; }
Example #10
Source File: RowBoundsPlugin.java From mybatis-generator-core-fix with Apache License 2.0 | 5 votes |
@Override public boolean sqlMapSelectByExampleWithoutBLOBsElementGenerated( XmlElement element, IntrospectedTable introspectedTable) { if (introspectedTable.getTargetRuntime() == TargetRuntime.MYBATIS3) { copyAndSaveElement(element, introspectedTable.getFullyQualifiedTable()); } return true; }
Example #11
Source File: RowBoundsPlugin.java From mybatis-generator-core-fix with Apache License 2.0 | 5 votes |
@Override public boolean clientSelectByExampleWithoutBLOBsMethodGenerated( Method method, Interface interfaze, IntrospectedTable introspectedTable) { if (introspectedTable.getTargetRuntime() == TargetRuntime.MYBATIS3) { copyAndAddMethod(method, interfaze); } return true; }
Example #12
Source File: RowBoundsPlugin.java From mybatis-generator-core-fix with Apache License 2.0 | 5 votes |
@Override public boolean clientSelectByExampleWithBLOBsMethodGenerated(Method method, Interface interfaze, IntrospectedTable introspectedTable) { if (introspectedTable.getTargetRuntime() == TargetRuntime.MYBATIS3) { copyAndAddMethod(method, interfaze); } return true; }
Example #13
Source File: FluentBuilderMethodsPlugin.java From mapper-generator-javafx with Apache License 2.0 | 5 votes |
@Override public boolean modelSetterMethodGenerated(Method method, TopLevelClass topLevelClass, IntrospectedColumn introspectedColumn, IntrospectedTable introspectedTable, ModelClassType modelClassType) { Method fluentMethod = new Method("with" + method.getName().substring(3)); fluentMethod.setVisibility(JavaVisibility.PUBLIC); fluentMethod.setReturnType(topLevelClass.getType()); fluentMethod.getParameters().addAll(method.getParameters()); if (introspectedTable.getTargetRuntime() == TargetRuntime.MYBATIS3_DSQL) { context.getCommentGenerator().addGeneralMethodAnnotation(fluentMethod, introspectedTable, topLevelClass.getImportedTypes()); } else { context.getCommentGenerator().addGeneralMethodComment(fluentMethod, introspectedTable); } StringBuilder sb = new StringBuilder() .append("this.") .append(method.getName()) .append('(') .append(introspectedColumn.getJavaProperty()) .append(");"); fluentMethod.addBodyLine(sb.toString()); fluentMethod.addBodyLine("return this;"); topLevelClass.addMethod(fluentMethod); return super.modelSetterMethodGenerated(method, topLevelClass, introspectedColumn, introspectedTable, modelClassType); }
Example #14
Source File: ToStringPlugin.java From mapper-generator-javafx with Apache License 2.0 | 5 votes |
private void generateToString(IntrospectedTable introspectedTable, TopLevelClass topLevelClass) { Method method = new Method("toString"); method.setVisibility(JavaVisibility.PUBLIC); method.setReturnType(FullyQualifiedJavaType.getStringInstance()); method.addAnnotation("@Override"); if (introspectedTable.getTargetRuntime() == TargetRuntime.MYBATIS3_DSQL) { context.getCommentGenerator().addGeneralMethodAnnotation(method, introspectedTable, topLevelClass.getImportedTypes()); } else { context.getCommentGenerator().addGeneralMethodComment(method, introspectedTable); } method.addBodyLine("StringBuilder sb = new StringBuilder();"); method.addBodyLine("sb.append(getClass().getSimpleName());"); method.addBodyLine("sb.append(\" [\");"); method.addBodyLine("sb.append(\"Hash = \").append(hashCode());"); StringBuilder sb = new StringBuilder(); for (Field field : topLevelClass.getFields()) { String property = field.getName(); sb.setLength(0); sb.append("sb.append(\"").append(", ").append(property) //$NON-NLS-2$ .append("=\")").append(".append(").append(property) //$NON-NLS-2$ .append(");"); method.addBodyLine(sb.toString()); } method.addBodyLine("sb.append(\"]\");"); if (useToStringFromRoot && topLevelClass.getSuperClass().isPresent()) { method.addBodyLine("sb.append(\", from super class \");"); method.addBodyLine("sb.append(super.toString());"); } method.addBodyLine("return sb.toString();"); topLevelClass.addMethod(method); }
Example #15
Source File: SerializablePlugin.java From mapper-generator-javafx with Apache License 2.0 | 5 votes |
protected void makeSerializable(TopLevelClass topLevelClass, IntrospectedTable introspectedTable) { final boolean serializable = Boolean.parseBoolean(introspectedTable.getTableConfigurationProperty("jdkSerializable")); if (!serializable) { return; } if (addGWTInterface) { topLevelClass.addImportedType(gwtSerializable); topLevelClass.addSuperInterface(gwtSerializable); } if (!suppressJavaInterface) { topLevelClass.addImportedType(this.serializable); topLevelClass.addSuperInterface(this.serializable); Field field = new Field("serialVersionUID", new FullyQualifiedJavaType("long")); field.setFinal(true); field.setInitializationString("1L"); field.setStatic(true); field.setVisibility(JavaVisibility.PRIVATE); if (introspectedTable.getTargetRuntime() == TargetRuntime.MYBATIS3_DSQL) { context.getCommentGenerator().addFieldAnnotation(field, introspectedTable, topLevelClass.getImportedTypes()); } else { context.getCommentGenerator().addFieldComment(field, introspectedTable); } topLevelClass.addField(field); } }
Example #16
Source File: MapperAnnotationPlugin.java From mapper-generator-javafx with Apache License 2.0 | 5 votes |
@Override public boolean clientGenerated(Interface interfaze, IntrospectedTable introspectedTable) { if (introspectedTable.getTargetRuntime() == TargetRuntime.MYBATIS3) { // don't need to do this for MYBATIS3_DSQL as that runtime already adds this annotation interfaze.addImportedType(new FullyQualifiedJavaType("org.apache.ibatis.annotations.Mapper")); interfaze.addAnnotation("@Mapper"); } return true; }
Example #17
Source File: RowBoundsPlugin.java From mapper-generator-javafx with Apache License 2.0 | 5 votes |
@Override public boolean sqlMapSelectByExampleWithBLOBsElementGenerated( XmlElement element, IntrospectedTable introspectedTable) { if (introspectedTable.getTargetRuntime() == TargetRuntime.MYBATIS3) { copyAndSaveElement(element, introspectedTable.getFullyQualifiedTable()); } return true; }
Example #18
Source File: RowBoundsPlugin.java From mapper-generator-javafx with Apache License 2.0 | 5 votes |
@Override public boolean sqlMapSelectByExampleWithoutBLOBsElementGenerated( XmlElement element, IntrospectedTable introspectedTable) { if (introspectedTable.getTargetRuntime() == TargetRuntime.MYBATIS3) { copyAndSaveElement(element, introspectedTable.getFullyQualifiedTable()); } return true; }
Example #19
Source File: RowBoundsPlugin.java From mapper-generator-javafx with Apache License 2.0 | 5 votes |
@Override public boolean clientSelectByExampleWithoutBLOBsMethodGenerated( Method method, Interface interfaze, IntrospectedTable introspectedTable) { if (introspectedTable.getTargetRuntime() == TargetRuntime.MYBATIS3) { copyAndAddMethod(method, interfaze); } return true; }
Example #20
Source File: BaseRules.java From mapper-generator-javafx with Apache License 2.0 | 5 votes |
/** * Implements the rule for generating the SQL example where clause element * specifically for use in the update by example methods. * * <p>In MyBatis3, generate the element if the updateByExample statements are * allowed. * * @return true if the SQL where clause element should be generated */ @Override public boolean generateMyBatis3UpdateByExampleWhereClause() { if (isModelOnly) { return false; } return introspectedTable.getTargetRuntime() == TargetRuntime.MYBATIS3 && tableConfiguration.isUpdateByExampleStatementEnabled(); }
Example #21
Source File: BaseRules.java From mybatis-generator-core-fix with Apache License 2.0 | 3 votes |
/** * Implements the rule for generating the SQL example where clause element * specifically for use in the update by example methods. * * In iBATIS2, do not generate the element. * * In MyBatis3, generate the element if the updateByExample statements are * allowed. * * @return true if the SQL where clause element should be generated */ public boolean generateMyBatis3UpdateByExampleWhereClause() { if (isModelOnly) { return false; } return introspectedTable.getTargetRuntime() == TargetRuntime.MYBATIS3 && tableConfiguration.isUpdateByExampleStatementEnabled(); }
Example #22
Source File: BaseRules.java From mybatis-generator-plus with Apache License 2.0 | 3 votes |
/** * Implements the rule for generating the SQL example where clause element * specifically for use in the update by example methods. * * In iBATIS2, do not generate the element. * * In MyBatis3, generate the element if the updateByExample statements are * allowed. * * @return true if the SQL where clause element should be generated */ public boolean generateMyBatis3UpdateByExampleWhereClause() { if (isModelOnly) { return false; } return introspectedTable.getTargetRuntime() == TargetRuntime.MYBATIS3 && tableConfiguration.isUpdateByExampleStatementEnabled(); }