Java Code Examples for org.mybatis.generator.api.IntrospectedTable.TargetRuntime#MYBATIS3_DSQL
The following examples show how to use
org.mybatis.generator.api.IntrospectedTable.TargetRuntime#MYBATIS3_DSQL .
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: 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 2
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 3
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 4
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 5
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); }