org.mybatis.generator.api.dom.java.Method Java Examples

The following examples show how to use org.mybatis.generator.api.dom.java.Method. 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: MyMapperCommentGenerator.java    From jvue-admin with MIT License 6 votes vote down vote up
/**
 * getter方法注释
 *
 * @param method
 * @param introspectedTable
 * @param introspectedColumn
 */
@Override
public void addGetterComment(Method method, IntrospectedTable introspectedTable, IntrospectedColumn introspectedColumn) {
    StringBuilder sb = new StringBuilder();
    method.addJavaDocLine("/**");
    if (StringUtility.stringHasValue(introspectedColumn.getRemarks())) {
        sb.append(" * 获取");
        sb.append(introspectedColumn.getRemarks());
        method.addJavaDocLine(sb.toString());
        method.addJavaDocLine(" *");
    }
    sb.setLength(0);
    sb.append(" * @return ");
    sb.append(introspectedColumn.getActualColumnName());
    if (StringUtility.stringHasValue(introspectedColumn.getRemarks())) {
        sb.append(" - ");
        sb.append(introspectedColumn.getRemarks());
    }
    method.addJavaDocLine(sb.toString());
    method.addJavaDocLine(" */");
}
 
Example #2
Source File: UpdateByPrimaryKeyWithBLOBsMethodGenerator.java    From mybatis-generator-plus with Apache License 2.0 6 votes vote down vote up
@Override
public void addImplementationElements(TopLevelClass topLevelClass) {
    Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
    Method method = getMethodShell(importedTypes);

    StringBuilder sb = new StringBuilder();
    sb.append("int rows = "); //$NON-NLS-1$
    sb.append(daoTemplate.getUpdateMethod(introspectedTable
            .getIbatis2SqlMapNamespace(), introspectedTable
            .getUpdateByPrimaryKeyWithBLOBsStatementId(), "record")); //$NON-NLS-1$
    method.addBodyLine(sb.toString());

    method.addBodyLine("return rows;"); //$NON-NLS-1$

    if (context.getPlugins()
            .clientUpdateByPrimaryKeyWithBLOBsMethodGenerated(method,
                    topLevelClass, introspectedTable)) {
        topLevelClass.addImportedTypes(importedTypes);
        topLevelClass.addMethod(method);
    }
}
 
Example #3
Source File: UpdateByPrimaryKeyWithoutBLOBsMethodGenerator.java    From mybatis-generator-plus with Apache License 2.0 6 votes vote down vote up
@Override
public void addInterfaceElements(Interface interfaze) {
    Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
    FullyQualifiedJavaType parameterType = new FullyQualifiedJavaType(
            introspectedTable.getBaseRecordType());
    importedTypes.add(parameterType);

    Method method = new Method();
    method.setVisibility(JavaVisibility.PUBLIC);
    method.setReturnType(FullyQualifiedJavaType.getIntInstance());
    method.setName(introspectedTable.getUpdateByPrimaryKeyStatementId());
    method.addParameter(new Parameter(parameterType, "record")); //$NON-NLS-1$

    context.getCommentGenerator().addGeneralMethodComment(method,
            introspectedTable);

    addMapperAnnotations(interfaze, method);
    
    if (context.getPlugins()
            .clientUpdateByPrimaryKeyWithoutBLOBsMethodGenerated(method,
                    interfaze, introspectedTable)) {
        interfaze.addImportedTypes(importedTypes);
        interfaze.addMethod(method);
    }
}
 
Example #4
Source File: SelectiveEnhancedPlugin.java    From mybatis-generator-plugin with Apache License 2.0 6 votes vote down vote up
/**
 * 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 #5
Source File: PluginAggregator.java    From mybatis-generator-core-fix with Apache License 2.0 6 votes vote down vote up
public boolean modelSetterMethodGenerated(Method method,
        TopLevelClass topLevelClass, IntrospectedColumn introspectedColumn,
        IntrospectedTable introspectedTable,
        Plugin.ModelClassType modelClassType) {
    boolean rc = true;

    for (Plugin plugin : plugins) {
        if (!plugin.modelSetterMethodGenerated(method, topLevelClass,
                introspectedColumn, introspectedTable, modelClassType)) {
            rc = false;
            break;
        }
    }

    return rc;
}
 
Example #6
Source File: OptimisticLockingPluginTest.java    From mybatis-generator-plugins with Apache License 2.0 6 votes vote down vote up
@Test
public void shouldAddConditionToWhereClauseInAnnotation() {
	// Given
	Method realMethod = new Method("methodName");
	realMethod.addAnnotation("@Update({");
	realMethod.addAnnotation("    \"update schema.table_name\",");
	realMethod.addAnnotation("    \"set id = #{id,jdbcType=INT},\",");
	realMethod.addAnnotation("      \"other_column = #{other,jdbcType=INT},\",");
	realMethod.addAnnotation("    \"where id = #{id,jdbcType=BIGINT}\"");
	realMethod.addAnnotation("})");

	// When
	Method newMethod = plugin.addMethod(realMethod, introspectedTable);

	// Then
	then(newMethod).isNotNull();
	then(newMethod.getName()).isEqualTo(realMethod.getName() + OptimisticLockingPlugin.METHOD_SUFFIX);

	then(newMethod.getAnnotations()).hasSize(realMethod.getAnnotations().size() + 1);
	then(newMethod.getAnnotations()).containsAll(realMethod.getAnnotations().subList(0, 4));
	then(newMethod.getAnnotations().get(4)).isEqualTo(realMethod.getAnnotations().get(4) + ",");
	then(newMethod.getAnnotations().get(5)).contains(String.format("and %s = ", LOCK_COLUMN_FUNCTION));
	then(newMethod.getAnnotations().get(6)).isEqualTo(realMethod.getAnnotations().get(5));
}
 
Example #7
Source File: SelectByExampleWithoutBLOBsMethodGenerator.java    From mybatis-generator-plus with Apache License 2.0 6 votes vote down vote up
@Override
public void addImplementationElements(TopLevelClass topLevelClass) {
    Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
    Method method = getMethodShell(importedTypes);

    if (generateForJava5) {
        method.addSuppressTypeWarningsAnnotation();
    }

    StringBuilder sb = new StringBuilder();
    sb.append(method.getReturnType().getShortName());
    sb.append(" list = "); //$NON-NLS-1$
    sb.append(daoTemplate.getQueryForListMethod(introspectedTable
            .getIbatis2SqlMapNamespace(), introspectedTable
            .getSelectByExampleStatementId(), "example")); //$NON-NLS-1$
    method.addBodyLine(sb.toString());
    method.addBodyLine("return list;"); //$NON-NLS-1$

    if (context.getPlugins()
            .clientSelectByExampleWithoutBLOBsMethodGenerated(method,
                    topLevelClass, introspectedTable)) {
        topLevelClass.addImportedTypes(importedTypes);
        topLevelClass.addMethod(method);
    }
}
 
Example #8
Source File: DefaultCommentGenerator.java    From mybatis-generator-plus with Apache License 2.0 6 votes vote down vote up
public void addGeneralMethodComment(Method method,
        IntrospectedTable introspectedTable) {
    if (suppressAllComments) {
        return;
    }

    StringBuilder sb = new StringBuilder();

    method.addJavaDocLine("/**"); //$NON-NLS-1$
    method
            .addJavaDocLine(" * This method was generated by MyBatis Generator."); //$NON-NLS-1$

    sb.append(" * This method corresponds to the database table "); //$NON-NLS-1$
    sb.append(introspectedTable.getFullyQualifiedTable());
    method.addJavaDocLine(sb.toString());

    addJavadocTag(method, false);

    method.addJavaDocLine(" */"); //$NON-NLS-1$
}
 
Example #9
Source File: PluginAggregator.java    From mapper-generator-javafx with Apache License 2.0 6 votes vote down vote up
@Override
public boolean providerUpdateByPrimaryKeySelectiveMethodGenerated(
        Method method, TopLevelClass topLevelClass,
        IntrospectedTable introspectedTable) {
    boolean rc = true;

    for (Plugin plugin : plugins) {
        if (!plugin.providerUpdateByPrimaryKeySelectiveMethodGenerated(method,
                topLevelClass, introspectedTable)) {
            rc = false;
            break;
        }
    }

    return rc;
}
 
Example #10
Source File: PluginAggregator.java    From mapper-generator-javafx with Apache License 2.0 6 votes vote down vote up
@Override
public boolean providerUpdateByExampleWithBLOBsMethodGenerated(
        Method method, TopLevelClass topLevelClass,
        IntrospectedTable introspectedTable) {
    boolean rc = true;

    for (Plugin plugin : plugins) {
        if (!plugin.providerUpdateByExampleWithBLOBsMethodGenerated(method,
                topLevelClass, introspectedTable)) {
            rc = false;
            break;
        }
    }

    return rc;
}
 
Example #11
Source File: CreateSubPackagePlugin.java    From mybatis-generator-plugins with Apache License 2.0 6 votes vote down vote up
/**
 * Rename the method types.
 *
 * @param method
 *            the method
 * @return true
 */
boolean renameMethod(Method method) {
	method.setReturnType(modelProperties.renameType(method.getReturnType()));

	for (int i = 0; i < method.getParameters().size(); i++) {
		Parameter parameter = method.getParameters().get(i);
		FullyQualifiedJavaType parameterType = parameter.getType();
		FullyQualifiedJavaType newParameterType = modelProperties.renameType(parameterType);
		if (parameterType != newParameterType) {
			Parameter newParam = new Parameter(newParameterType, parameter.getName(), parameter.isVarargs());
			for (String annotation : parameter.getAnnotations()) {
				newParam.addAnnotation(annotation);
			}
			method.getParameters().set(i, newParam);
			log.debug("set new parameter: [{}][{}]", parameter, newParam);
		}
	}

	modelProperties.renameAnnotations(method.getAnnotations());
	mapperProperties.renameAnnotations(method.getAnnotations());

	return true;
}
 
Example #12
Source File: CountByExampleMethodGenerator.java    From mapper-generator-javafx with Apache License 2.0 6 votes vote down vote up
@Override
public void addInterfaceElements(Interface interfaze) {
    FullyQualifiedJavaType fqjt = new FullyQualifiedJavaType(
            introspectedTable.getExampleType());

    Set<FullyQualifiedJavaType> importedTypes = new TreeSet<>();
    importedTypes.add(fqjt);

    Method method = new Method(introspectedTable.getCountByExampleStatementId());
    method.setVisibility(JavaVisibility.PUBLIC);
    method.setAbstract(true);
    method.setReturnType(new FullyQualifiedJavaType("long"));
    method.addParameter(new Parameter(fqjt, "example"));
    context.getCommentGenerator().addGeneralMethodComment(method,
            introspectedTable);

    addMapperAnnotations(method);
    
    if (context.getPlugins().clientCountByExampleMethodGenerated(method,
            interfaze, introspectedTable)) {
        addExtraImports(interfaze);
        interfaze.addImportedTypes(importedTypes);
        interfaze.addMethod(method);
    }
}
 
Example #13
Source File: AnnotatedUpdateByExampleSelectiveMethodGenerator.java    From mapper-generator-javafx with Apache License 2.0 5 votes vote down vote up
@Override
public void addMapperAnnotations(Method method) {
    FullyQualifiedJavaType fqjt = new FullyQualifiedJavaType(introspectedTable.getMyBatis3SqlProviderType());
    StringBuilder sb = new StringBuilder();
    sb.append("@UpdateProvider(type=");
    sb.append(fqjt.getShortName());
    sb.append(".class, method=\"");
    sb.append(introspectedTable.getUpdateByExampleSelectiveStatementId());
    sb.append("\")");

    method.addAnnotation(sb.toString());
}
 
Example #14
Source File: PluginAggregator.java    From mybatis-generator-core-fix with Apache License 2.0 5 votes vote down vote up
public boolean providerCountByExampleMethodGenerated(Method method,
        TopLevelClass topLevelClass, IntrospectedTable introspectedTable) {
    boolean rc = true;

    for (Plugin plugin : plugins) {
        if (!plugin.providerCountByExampleMethodGenerated(method,
                topLevelClass, introspectedTable)) {
            rc = false;
            break;
        }
    }

    return rc;
}
 
Example #15
Source File: PluginAggregator.java    From mybatis-generator-plus with Apache License 2.0 5 votes vote down vote up
public boolean modelSetterMethodGenerated(Method method, TopLevelClass topLevelClass, IntrospectedColumn introspectedColumn, IntrospectedTable introspectedTable,
		Plugin.ModelClassType modelClassType) {
	boolean rc = true;

	for (Plugin plugin : plugins) {
		if (!plugin.modelSetterMethodGenerated(method, topLevelClass, introspectedColumn, introspectedTable, modelClassType)) {
			rc = false;
			break;
		}
	}

	return rc;
}
 
Example #16
Source File: AbstractJavaGenerator.java    From mybatis-generator-core-fix with Apache License 2.0 5 votes vote down vote up
public static Method getGetter(Field field) {
    Method method = new Method();
    method.setName(getGetterMethodName(field.getName(), field
            .getType()));
    method.setReturnType(field.getType());
    method.setVisibility(JavaVisibility.PUBLIC);
    StringBuilder sb = new StringBuilder();
    sb.append("return "); //$NON-NLS-1$
    sb.append(field.getName());
    sb.append(';');
    method.addBodyLine(sb.toString());
    return method;
}
 
Example #17
Source File: SelectByExampleWithoutBLOBsMethodGenerator.java    From mybatis-generator-plus with Apache License 2.0 5 votes vote down vote up
@Override
public void addInterfaceElements(Interface interfaze) {
    if (getExampleMethodVisibility() == JavaVisibility.PUBLIC) {
        Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
        Method method = getMethodShell(importedTypes);

        if (context.getPlugins()
                .clientSelectByExampleWithoutBLOBsMethodGenerated(method,
                        interfaze, introspectedTable)) {
            interfaze.addImportedTypes(importedTypes);
            interfaze.addMethod(method);
        }
    }
}
 
Example #18
Source File: AnnotatedUpdateByExampleSelectiveMethodGenerator.java    From mybatis-generator-core-fix with Apache License 2.0 5 votes vote down vote up
@Override
public void addMapperAnnotations(Interface interfaze, Method method) {
    FullyQualifiedJavaType fqjt = new FullyQualifiedJavaType(introspectedTable.getMyBatis3SqlProviderType());
    interfaze.addImportedType(new FullyQualifiedJavaType("org.apache.ibatis.annotations.UpdateProvider")); //$NON-NLS-1$
    StringBuilder sb = new StringBuilder();
    sb.append("@UpdateProvider(type="); //$NON-NLS-1$
    sb.append(fqjt.getShortName());
    sb.append(".class, method=\""); //$NON-NLS-1$
    sb.append(introspectedTable.getUpdateByExampleSelectiveStatementId());
    sb.append("\")"); //$NON-NLS-1$
    
    method.addAnnotation(sb.toString());
}
 
Example #19
Source File: DAOGenerator.java    From mybatis-generator-plus with Apache License 2.0 5 votes vote down vote up
protected TopLevelClass getTopLevelClassShell() {
    FullyQualifiedJavaType interfaceType = new FullyQualifiedJavaType(
            introspectedTable.getDAOInterfaceType());
    FullyQualifiedJavaType implementationType = new FullyQualifiedJavaType(
            introspectedTable.getDAOImplementationType());

    CommentGenerator commentGenerator = context.getCommentGenerator();

    TopLevelClass answer = new TopLevelClass(implementationType);
    answer.setVisibility(JavaVisibility.PUBLIC);
    answer.setSuperClass(daoTemplate.getSuperClass());
    answer.addImportedType(daoTemplate.getSuperClass());
    answer.addSuperInterface(interfaceType);
    answer.addImportedType(interfaceType);

    for (FullyQualifiedJavaType fqjt : daoTemplate
            .getImplementationImports()) {
        answer.addImportedType(fqjt);
    }

    commentGenerator.addJavaFileComment(answer);

    // add constructor from the template
    answer.addMethod(daoTemplate.getConstructorClone(commentGenerator,
            implementationType, introspectedTable));

    // add any fields from the template
    for (Field field : daoTemplate.getFieldClones(commentGenerator,
            introspectedTable)) {
        answer.addField(field);
    }

    // add any methods from the template
    for (Method method : daoTemplate.getMethodClones(commentGenerator,
            introspectedTable)) {
        answer.addMethod(method);
    }

    return answer;
}
 
Example #20
Source File: InsertControllerGenerator.java    From maven-archetype with GNU Lesser General Public License v2.1 5 votes vote down vote up
public static List<Method> generator(FullyQualifiedJavaType beanType,String beanName,
		String businessFieldName){
	List<Method> methodList = new ArrayList<Method>();
	
	String beanFieldName = StringUtils.uncapitalize(beanName);
	
	Method method = new Method();
	method.addAnnotation("@RequestMapping(value = \"insert.do\")");
	method.setVisibility(JavaVisibility.PUBLIC);
	method.setReturnType(new FullyQualifiedJavaType(String.class.getName()));
	method.setName("insert");
	Parameter param = new Parameter(beanType, beanFieldName);
	param.addAnnotation("@ModelAttribute(\"" + beanFieldName + "\") ");
	Parameter paramModelMap = new Parameter(new FullyQualifiedJavaType(ModelMap.class.getName()), "map");
	method.addParameter(param); 
	method.addParameter(paramModelMap); 
	// 方法body
	method.addBodyLine("try {");
	method.addBodyLine("// 数据校验");
	method.addBodyLine("");
	method.addBodyLine("if(this." + businessFieldName + ".insertSelective(" + beanFieldName + ") == 1){");
	method.addBodyLine("map.put(\"message\",\"插入成功。\");");
	method.addBodyLine("}else{");
	method.addBodyLine("map.put(\"message\",\"插入失败。\");");
	method.addBodyLine("}");
	method.addBodyLine("} catch (Exception e) {");
	method.addBodyLine("logger.error(\"插入异常\" + e.getMessage());");
	method.addBodyLine("map.put(\"message\",\"插入异常\" + e.getMessage());");
	method.addBodyLine("}");
	method.addBodyLine(ControllerPluginUtil.RETURN);
	
	methodList.add(method);
       
       return methodList;
}
 
Example #21
Source File: UpdateByPrimaryKeySelectiveMethodGenerator.java    From mapper-generator-javafx with Apache License 2.0 5 votes vote down vote up
@Override
public MethodAndImports generateMethodAndImports() {
    if (!introspectedTable.getRules().generateUpdateByPrimaryKeySelective()) {
        return null;
    }

    Set<FullyQualifiedJavaType> imports = new HashSet<>();

    imports.add(new FullyQualifiedJavaType("org.mybatis.dynamic.sql.update.UpdateDSL"));
    imports.add(recordType);
    
    Method method = new Method("updateByPrimaryKeySelective");
    method.setDefault(true);
    context.getCommentGenerator().addGeneralMethodAnnotation(method, introspectedTable, imports);
    
    method.setReturnType(FullyQualifiedJavaType.getIntInstance());
    method.addParameter(new Parameter(recordType, "record"));

    method.addBodyLine("return UpdateDSL.updateWithMapper(this::update, "
            + tableFieldName + ")");

    method.addBodyLines(
            fragmentGenerator.getSetEqualWhenPresentLines(introspectedTable.getNonPrimaryKeyColumns(), false));
    method.addBodyLines(fragmentGenerator.getPrimaryKeyWhereClauseForUpdate());
    method.addBodyLine("        .build()");
    method.addBodyLine("        .execute();");

    return MethodAndImports.withMethod(method)
            .withImports(imports)
            .build();
}
 
Example #22
Source File: PluginAggregator.java    From mybatis-generator-plus with Apache License 2.0 5 votes vote down vote up
public boolean clientInsertMethodGenerated(Method method, Interface interfaze, IntrospectedTable introspectedTable) {
	boolean rc = true;

	for (Plugin plugin : plugins) {
		if (!plugin.clientInsertMethodGenerated(method, interfaze, introspectedTable)) {
			rc = false;
			break;
		}
	}

	return rc;
}
 
Example #23
Source File: PluginAggregator.java    From mybatis-generator-plus with Apache License 2.0 5 votes vote down vote up
public boolean providerUpdateByExampleWithBLOBsMethodGenerated(Method method, TopLevelClass topLevelClass, IntrospectedTable introspectedTable) {
	boolean rc = true;

	for (Plugin plugin : plugins) {
		if (!plugin.providerUpdateByExampleWithBLOBsMethodGenerated(method, topLevelClass, introspectedTable)) {
			rc = false;
			break;
		}
	}

	return rc;
}
 
Example #24
Source File: JavaBeansUtil.java    From mybatis-generator-core-fix with Apache License 2.0 5 votes vote down vote up
/**
 * Gets the java beans setter.
 *
 * @param introspectedColumn
 *            the introspected column
 * @param context
 *            the context
 * @param introspectedTable
 *            the introspected table
 * @return the java beans setter
 */
public static Method getJavaBeansSetter(IntrospectedColumn introspectedColumn,
        Context context,
        IntrospectedTable introspectedTable) {
    FullyQualifiedJavaType fqjt = introspectedColumn
            .getFullyQualifiedJavaType();
    String property = introspectedColumn.getJavaProperty();

    Method method = new Method();
    method.setVisibility(JavaVisibility.PUBLIC);
    method.setName(getSetterMethodName(property));
    method.addParameter(new Parameter(fqjt, property));
    context.getCommentGenerator().addSetterComment(method,
            introspectedTable, introspectedColumn);

    StringBuilder sb = new StringBuilder();
    if (isTrimStringsEnabled(context) && introspectedColumn.isStringColumn()) {
        sb.append("this."); //$NON-NLS-1$
        sb.append(property);
        sb.append(" = "); //$NON-NLS-1$
        sb.append(property);
        sb.append(" == null ? null : "); //$NON-NLS-1$
        sb.append(property);
        sb.append(".trim();"); //$NON-NLS-1$
        method.addBodyLine(sb.toString());
    } else {
        sb.append("this."); //$NON-NLS-1$
        sb.append(property);
        sb.append(" = "); //$NON-NLS-1$
        sb.append(property);
        sb.append(';');
        method.addBodyLine(sb.toString());
    }

    return method;
}
 
Example #25
Source File: AlterResultMapPlugin.java    From mybatis-generator-plugins with Apache License 2.0 5 votes vote down vote up
@Override
public boolean clientSelectByExampleWithoutBLOBsMethodGenerated(Method method, TopLevelClass topLevelClass,
		IntrospectedTable introspectedTable) {
	renameResultMapAttribute(method, introspectedTable);

	return true;
}
 
Example #26
Source File: AlterResultMapPlugin.java    From mybatis-generator-plugins with Apache License 2.0 5 votes vote down vote up
@Override
public boolean clientSelectAllMethodGenerated(Method method, TopLevelClass topLevelClass,
		IntrospectedTable introspectedTable) {
	renameResultMapAttribute(method, introspectedTable);

	return true;
}
 
Example #27
Source File: UpdateByPrimaryKeyWithoutBLOBsMethodGenerator.java    From mybatis-generator-plus with Apache License 2.0 5 votes vote down vote up
@Override
public void addInterfaceElements(Interface interfaze) {
    Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
    Method method = getMethodShell(importedTypes);

    if (context.getPlugins()
            .clientUpdateByPrimaryKeyWithoutBLOBsMethodGenerated(method,
                    interfaze, introspectedTable)) {
        interfaze.addImportedTypes(importedTypes);
        interfaze.addMethod(method);
    }
}
 
Example #28
Source File: PluginAggregator.java    From mybatis-generator-plus with Apache License 2.0 5 votes vote down vote up
public boolean clientUpdateByExampleWithBLOBsMethodGenerated(Method method, Interface interfaze, IntrospectedTable introspectedTable) {
	boolean rc = true;

	for (Plugin plugin : plugins) {
		if (!plugin.clientUpdateByExampleWithBLOBsMethodGenerated(method, interfaze, introspectedTable)) {
			rc = false;
			break;
		}
	}

	return rc;
}
 
Example #29
Source File: PluginAggregator.java    From mybatis-generator-plus with Apache License 2.0 5 votes vote down vote up
public boolean clientInsertMethodGenerated(Method method, TopLevelClass topLevelClass, IntrospectedTable introspectedTable) {
	boolean rc = true;

	for (Plugin plugin : plugins) {
		if (!plugin.clientInsertMethodGenerated(method, topLevelClass, introspectedTable)) {
			rc = false;
			break;
		}
	}

	return rc;
}
 
Example #30
Source File: PluginAggregator.java    From mybatis-generator-core-fix with Apache License 2.0 5 votes vote down vote up
public boolean clientUpdateByPrimaryKeyWithBLOBsMethodGenerated(Method method,
        TopLevelClass topLevelClass, IntrospectedTable introspectedTable) {
    boolean rc = true;

    for (Plugin plugin : plugins) {
        if (!plugin.clientUpdateByPrimaryKeyWithBLOBsMethodGenerated(method,
                topLevelClass, introspectedTable)) {
            rc = false;
            break;
        }
    }

    return rc;
}