当前位置: 首页>>代码示例>>Java>>正文


Java Method.setConstructor方法代码示例

本文整理汇总了Java中org.mybatis.generator.api.dom.java.Method.setConstructor方法的典型用法代码示例。如果您正苦于以下问题:Java Method.setConstructor方法的具体用法?Java Method.setConstructor怎么用?Java Method.setConstructor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.mybatis.generator.api.dom.java.Method的用法示例。


在下文中一共展示了Method.setConstructor方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getConstructorClone

import org.mybatis.generator.api.dom.java.Method; //导入方法依赖的package包/类
/**
 * Gets the constructor clone.
 *
 * @param commentGenerator
 *            the comment generator
 * @param type
 *            the type
 * @param introspectedTable
 *            the introspected table
 * @return the constructor clone
 */
public final Method getConstructorClone(CommentGenerator commentGenerator,
        FullyQualifiedJavaType type, IntrospectedTable introspectedTable) {
    configure();
    Method answer = new Method();
    answer.setConstructor(true);
    answer.setName(type.getShortName());
    answer.setVisibility(constructorTemplate.getVisibility());
    for (Parameter parm : constructorTemplate.getParameters()) {
        answer.addParameter(parm);
    }

    for (String bodyLine : constructorTemplate.getBodyLines()) {
        answer.addBodyLine(bodyLine);
    }

    for (FullyQualifiedJavaType fqjt : constructorTemplate.getExceptions()) {
        answer.addException(fqjt);
    }

    commentGenerator.addGeneralMethodComment(answer, introspectedTable);

    return answer;
}
 
开发者ID:bandaotixi,项目名称:generator_mybatis,代码行数:35,代码来源:AbstractDAOTemplate.java

示例2: addParameterizedConstructor

import org.mybatis.generator.api.dom.java.Method; //导入方法依赖的package包/类
private void addParameterizedConstructor(TopLevelClass topLevelClass) {
    Method method = new Method();
    method.setVisibility(JavaVisibility.PUBLIC);
    method.setConstructor(true);
    method.setName(topLevelClass.getType().getShortName());
    context.getCommentGenerator().addGeneralMethodComment(method, introspectedTable);
    
    StringBuilder sb = new StringBuilder();
    for (IntrospectedColumn introspectedColumn : introspectedTable
            .getPrimaryKeyColumns()) {
        method.addParameter(new Parameter(introspectedColumn.getFullyQualifiedJavaType(),
                introspectedColumn.getJavaProperty()));
        sb.setLength(0);
        sb.append("this."); //$NON-NLS-1$
        sb.append(introspectedColumn.getJavaProperty());
        sb.append(" = "); //$NON-NLS-1$
        sb.append(introspectedColumn.getJavaProperty());
        sb.append(';');
        method.addBodyLine(sb.toString());
    }
    
    topLevelClass.addMethod(method);
}
 
开发者ID:DomKing,项目名称:springbootWeb,代码行数:24,代码来源:PrimaryKeyGenerator.java

示例3: configureConstructorTemplate

import org.mybatis.generator.api.dom.java.Method; //导入方法依赖的package包/类
@Override
protected void configureConstructorTemplate() {
    Method method = new Method();
    method.setConstructor(true);
    method.setVisibility(JavaVisibility.PUBLIC);
    method.addParameter(new Parameter(fqjt, "daoManager")); //$NON-NLS-1$
    method.addBodyLine("super(daoManager);"); //$NON-NLS-1$
    setConstructorTemplate(method);
}
 
开发者ID:DomKing,项目名称:springbootWeb,代码行数:10,代码来源:IbatisDAOTemplate.java

示例4: configureConstructorTemplate

import org.mybatis.generator.api.dom.java.Method; //导入方法依赖的package包/类
@Override
protected void configureConstructorTemplate() {
    Method constructor = new Method();
    constructor.setConstructor(true);
    constructor.setVisibility(JavaVisibility.PUBLIC);
    constructor
            .addParameter(new Parameter(sqlMapClientType, "sqlMapClient")); //$NON-NLS-1$
    constructor.addBodyLine("super();"); //$NON-NLS-1$
    constructor.addBodyLine("this.sqlMapClient = sqlMapClient;"); //$NON-NLS-1$
    setConstructorTemplate(constructor);
}
 
开发者ID:nextyu,项目名称:summer-mybatis-generator,代码行数:12,代码来源:GenericCIDAOTemplate.java

示例5: getMethodClones

import org.mybatis.generator.api.dom.java.Method; //导入方法依赖的package包/类
/**
 * Gets the method clones.
 *
 * @param commentGenerator
 *            the comment generator
 * @param introspectedTable
 *            the introspected table
 * @return the method clones
 */
public final List<Method> getMethodClones(
        CommentGenerator commentGenerator,
        IntrospectedTable introspectedTable) {
    configure();
    List<Method> answer = new ArrayList<Method>();
    for (Method oldMethod : methods) {
        Method method = new Method();

        for (String bodyLine : oldMethod.getBodyLines()) {
            method.addBodyLine(bodyLine);
        }

        for (FullyQualifiedJavaType fqjt : oldMethod.getExceptions()) {
            method.addException(fqjt);
        }

        for (Parameter parm : oldMethod.getParameters()) {
            method.addParameter(parm);
        }

        method.setConstructor(oldMethod.isConstructor());
        method.setFinal(oldMethod.isFinal());
        method.setStatic(oldMethod.isStatic());
        method.setName(oldMethod.getName());
        method.setReturnType(oldMethod.getReturnType());
        method.setVisibility(oldMethod.getVisibility());

        commentGenerator.addGeneralMethodComment(method, introspectedTable);

        answer.add(method);
    }

    return answer;
}
 
开发者ID:bandaotixi,项目名称:generator_mybatis,代码行数:44,代码来源:AbstractDAOTemplate.java

示例6: configureConstructorTemplate

import org.mybatis.generator.api.dom.java.Method; //导入方法依赖的package包/类
@Override
protected void configureConstructorTemplate() {
    Method method = new Method();
    method.setConstructor(true);
    method.setVisibility(JavaVisibility.PUBLIC);
    method.addBodyLine("super();"); //$NON-NLS-1$
    setConstructorTemplate(method);
}
 
开发者ID:bandaotixi,项目名称:generator_mybatis,代码行数:9,代码来源:GenericSIDAOTemplate.java

示例7: addDefaultConstructor

import org.mybatis.generator.api.dom.java.Method; //导入方法依赖的package包/类
protected void addDefaultConstructor(TopLevelClass topLevelClass) {
    Method method = new Method();
    method.setVisibility(JavaVisibility.PUBLIC);
    method.setConstructor(true);
    method.setName(topLevelClass.getType().getShortName());
    method.addBodyLine("super();"); //$NON-NLS-1$
    context.getCommentGenerator().addGeneralMethodComment(method, introspectedTable);
    topLevelClass.addMethod(method);
}
 
开发者ID:bandaotixi,项目名称:generator_mybatis,代码行数:10,代码来源:AbstractJavaGenerator.java


注:本文中的org.mybatis.generator.api.dom.java.Method.setConstructor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。