Java Code Examples for org.mybatis.generator.api.dom.java.Interface#addMethod()

The following examples show how to use org.mybatis.generator.api.dom.java.Interface#addMethod() . 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: InsertSelectiveMethodGenerator.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>();
    Method method = new Method();

    method.setReturnType(FullyQualifiedJavaType.getIntInstance());
    method.setVisibility(JavaVisibility.PUBLIC);
    method.setName(introspectedTable.getInsertSelectiveStatementId());

    FullyQualifiedJavaType parameterType = introspectedTable.getRules()
            .calculateAllFieldsClass();

    importedTypes.add(parameterType);
    method.addParameter(new Parameter(parameterType, "record")); //$NON-NLS-1$

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

    addMapperAnnotations(interfaze, method);
    
    if (context.getPlugins().clientInsertSelectiveMethodGenerated(
            method, interfaze, introspectedTable)) {
        interfaze.addImportedTypes(importedTypes);
        interfaze.addMethod(method);
    }
}
 
Example 2
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 3
Source File: CountByExampleMethodGenerator.java    From mybatis-generator-core-fix 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<FullyQualifiedJavaType>();
    importedTypes.add(fqjt);

    Method method = new Method();
    method.setVisibility(JavaVisibility.PUBLIC);
    method.setReturnType(FullyQualifiedJavaType.getIntInstance());
    method.setName(introspectedTable.getCountByExampleStatementId());
    method.addParameter(new Parameter(fqjt, "example")); //$NON-NLS-1$
    context.getCommentGenerator().addGeneralMethodComment(method,
            introspectedTable);

    addMapperAnnotations(interfaze, method);
    
    if (context.getPlugins().clientCountByExampleMethodGenerated(method,
            interfaze, introspectedTable)) {
        interfaze.addImportedTypes(importedTypes);
        interfaze.addMethod(method);
    }
}
 
Example 4
Source File: DeleteByExampleMethodGenerator.java    From mapper-generator-javafx with Apache License 2.0 6 votes vote down vote up
@Override
public void addInterfaceElements(Interface interfaze) {
    Set<FullyQualifiedJavaType> importedTypes = new TreeSet<>();
    FullyQualifiedJavaType type = new FullyQualifiedJavaType(
            introspectedTable.getExampleType());
    importedTypes.add(type);

    Method method = new Method(introspectedTable.getDeleteByExampleStatementId());
    method.setVisibility(JavaVisibility.PUBLIC);
    method.setAbstract(true);
    method.setReturnType(FullyQualifiedJavaType.getIntInstance());
    method.addParameter(new Parameter(type, "example"));

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

    addMapperAnnotations(method);
    
    if (context.getPlugins().clientDeleteByExampleMethodGenerated(
            method, interfaze, introspectedTable)) {
        addExtraImports(interfaze);
        interfaze.addImportedTypes(importedTypes);
        interfaze.addMethod(method);
    }
}
 
Example 5
Source File: SelectByPrimaryKeyMethodGenerator.java    From mybatis-generator-core-fix 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().clientSelectByPrimaryKeyMethodGenerated(
            method, interfaze, introspectedTable)) {
        interfaze.addImportedTypes(importedTypes);
        interfaze.addMethod(method);
    }
}
 
Example 6
Source File: UpdateByPrimaryKeyWithBLOBsMethodGenerator.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()
            .clientUpdateByPrimaryKeyWithBLOBsMethodGenerated(method,
                    interfaze, introspectedTable)) {
        interfaze.addImportedTypes(importedTypes);
        interfaze.addMethod(method);
    }
}
 
Example 7
Source File: UpdateByExampleSelectiveMethodGenerator.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()
                .clientUpdateByExampleSelectiveMethodGenerated(method,
                        interfaze, introspectedTable)) {
            interfaze.addImportedTypes(importedTypes);
            interfaze.addMethod(method);
        }
    }
}
 
Example 8
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 9
Source File: UpdateByExampleWithBLOBsMethodGenerator.java    From mybatis-generator-core-fix 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()
                .clientUpdateByExampleWithBLOBsMethodGenerated(method,
                        interfaze, introspectedTable)) {
            interfaze.addImportedTypes(importedTypes);
            interfaze.addMethod(method);
        }
    }
}
 
Example 10
Source File: UpdateByPrimaryKeyWithoutBLOBsMethodGenerator.java    From mybatis-generator-core-fix 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 11
Source File: InsertMethodGenerator.java    From mybatis-generator-core-fix 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().clientInsertMethodGenerated(method,
            interfaze, introspectedTable)) {
        interfaze.addImportedTypes(importedTypes);
        interfaze.addMethod(method);
    }
}
 
Example 12
Source File: SelectByExampleWithBLOBsMethodGenerator.java    From mybatis-generator-core-fix 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()
                .clientSelectByExampleWithBLOBsMethodGenerated(method,
                        interfaze, introspectedTable)) {
            interfaze.addImportedTypes(importedTypes);
            interfaze.addMethod(method);
        }
    }
}
 
Example 13
Source File: UpdateByExampleWithoutBLOBsMethodGenerator.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()
                .clientUpdateByExampleWithoutBLOBsMethodGenerated(method,
                        interfaze, introspectedTable)) {
            interfaze.addImportedTypes(importedTypes);
            interfaze.addMethod(method);
        }
    }
}
 
Example 14
Source File: DeleteByPrimaryKeyMethodGenerator.java    From mybatis-generator-core-fix 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().clientDeleteByPrimaryKeyMethodGenerated(
            method, interfaze, introspectedTable)) {
        interfaze.addImportedTypes(importedTypes);
        interfaze.addMethod(method);
    }
}
 
Example 15
Source File: SelectByPrimaryKeyMethodGenerator.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().clientSelectByPrimaryKeyMethodGenerated(
            method, interfaze, introspectedTable)) {
        interfaze.addImportedTypes(importedTypes);
        interfaze.addMethod(method);
    }
}
 
Example 16
Source File: InsertMethodGenerator.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().clientInsertMethodGenerated(method,
            interfaze, introspectedTable)) {
        interfaze.addImportedTypes(importedTypes);
        interfaze.addMethod(method);
    }
}
 
Example 17
Source File: RowBoundsPlugin.java    From mapper-generator-javafx with Apache License 2.0 5 votes vote down vote up
/**
 * Use the method copy constructor to create a new method, then
 * add the rowBounds parameter.
 * 
 * @param fullyQualifiedTable the table
 * @param method the method
 */
private void copyAndAddMethod(Method method, Interface interfaze) {
    Method newMethod = new Method(method);
    newMethod.setName(method.getName() + "WithRowbounds");
    newMethod.addParameter(new Parameter(rowBounds, "rowBounds"));
    interfaze.addMethod(newMethod);
    interfaze.addImportedType(rowBounds);
}
 
Example 18
Source File: UpdateByExampleWithBLOBsMethodGenerator.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()
                .clientUpdateByExampleWithBLOBsMethodGenerated(method,
                        interfaze, introspectedTable)) {
            interfaze.addImportedTypes(importedTypes);
            interfaze.addMethod(method);
        }
    }
}
 
Example 19
Source File: RowBoundsPlugin.java    From mybatis-generator-core-fix with Apache License 2.0 5 votes vote down vote up
/**
 * Use the method copy constructor to create a new method, then
 * add the rowBounds parameter.
 * 
 * @param fullyQualifiedTable
 * @param method
 */
private void copyAndAddMethod(Method method, Interface interfaze) {
    Method newMethod = new Method(method);
    newMethod.setName(method.getName() + "WithRowbounds"); //$NON-NLS-1$
    newMethod.addParameter(new Parameter(rowBounds, "rowBounds")); //$NON-NLS-1$
    interfaze.addMethod(newMethod);
    interfaze.addImportedType(rowBounds);
}
 
Example 20
Source File: DeleteByPrimaryKeyMethodGenerator.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().clientDeleteByPrimaryKeyMethodGenerated(
            method, interfaze, introspectedTable)) {
        interfaze.addImportedTypes(importedTypes);
        interfaze.addMethod(method);
    }
}