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


Java PrimitiveTypeWrapper类代码示例

本文整理汇总了Java中org.mybatis.generator.api.dom.java.PrimitiveTypeWrapper的典型用法代码示例。如果您正苦于以下问题:Java PrimitiveTypeWrapper类的具体用法?Java PrimitiveTypeWrapper怎么用?Java PrimitiveTypeWrapper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


PrimitiveTypeWrapper类属于org.mybatis.generator.api.dom.java包,在下文中一共展示了PrimitiveTypeWrapper类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addLimit

import org.mybatis.generator.api.dom.java.PrimitiveTypeWrapper; //导入依赖的package包/类
private void addLimit(TopLevelClass topLevelClass, IntrospectedTable introspectedTable, String name)
{
    CommentGenerator commentGenerator = context.getCommentGenerator();
    Field field = new Field();
    field.setVisibility(JavaVisibility.PROTECTED);
    // field.setType(FullyQualifiedJavaType.getIntInstance());
    field.setType(PrimitiveTypeWrapper.getIntegerInstance());
    field.setName(name);
    // field.setInitializationString("-1");
    commentGenerator.addFieldComment(field, introspectedTable);
    topLevelClass.addField(field);
    char c = name.charAt(0);
    String camel = Character.toUpperCase(c) + name.substring(1);
    Method method = new Method();
    method.setVisibility(JavaVisibility.PUBLIC);
    method.setName("set" + camel);
    method.addParameter(new Parameter(PrimitiveTypeWrapper.getIntegerInstance(), name));
    method.addBodyLine("this." + name + "=" + name + ";");
    commentGenerator.addGeneralMethodComment(method, introspectedTable);
    topLevelClass.addMethod(method);
    method = new Method();
    method.setVisibility(JavaVisibility.PUBLIC);
    method.setReturnType(PrimitiveTypeWrapper.getIntegerInstance());
    method.setName("get" + camel);
    method.addBodyLine("return " + name + ";");
    commentGenerator.addGeneralMethodComment(method, introspectedTable);
    topLevelClass.addMethod(method);
}
 
开发者ID:ccdaisy,项目名称:mybatis-generator-mysql,代码行数:29,代码来源:PaginationPlugin.java

示例2: modelExampleClassGenerated

import org.mybatis.generator.api.dom.java.PrimitiveTypeWrapper; //导入依赖的package包/类
/**
 * 在查询条件类中添加offset与limitCount字段
 */
@Override
public boolean modelExampleClassGenerated(TopLevelClass topLevelClass, IntrospectedTable introspectedTable) {
	Field offsetField = new Field("offset", PrimitiveTypeWrapper.getIntegerInstance());
	offsetField.setInitializationString("-1");
	offsetField.setVisibility(JavaVisibility.PROTECTED);
	addField(topLevelClass, introspectedTable, offsetField);

	Field limitCountField = new Field("limitCount", PrimitiveTypeWrapper.getIntegerInstance());
	limitCountField.setInitializationString("-1");
	limitCountField.setVisibility(JavaVisibility.PROTECTED);
	addField(topLevelClass, introspectedTable, limitCountField);

	return super.modelExampleClassGenerated(topLevelClass, introspectedTable);
}
 
开发者ID:patrick-lau,项目名称:mybatis-generator-expand,代码行数:18,代码来源:MysqlPaginationPlugin.java

示例3: addImplementationElements

import org.mybatis.generator.api.dom.java.PrimitiveTypeWrapper; //导入依赖的package包/类
@Override
public void addImplementationElements(TopLevelClass topLevelClass) {
    Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
    Method method = getMethodShell(importedTypes);

    FullyQualifiedJavaType returnType = method.getReturnType();

    StringBuilder sb = new StringBuilder();

    if (returnType != null) {
        sb.append("Object newKey = "); //$NON-NLS-1$
    }

    sb.append(daoTemplate.getInsertMethod(introspectedTable
            .getIbatis2SqlMapNamespace(), introspectedTable
            .getInsertStatementId(), "record")); //$NON-NLS-1$
    method.addBodyLine(sb.toString());

    if (returnType != null) {
        if ("Object".equals(returnType.getShortName())) { //$NON-NLS-1$
            // no need to cast if the return type is Object
            method.addBodyLine("return newKey;"); //$NON-NLS-1$
        } else {
            sb.setLength(0);

            if (returnType.isPrimitive()) {
                PrimitiveTypeWrapper ptw = returnType
                        .getPrimitiveTypeWrapper();
                sb.append("return (("); //$NON-NLS-1$
                sb.append(ptw.getShortName());
                sb.append(") newKey"); //$NON-NLS-1$
                sb.append(")."); //$NON-NLS-1$
                sb.append(ptw.getToPrimitiveMethod());
                sb.append(';');
            } else {
                sb.append("return ("); //$NON-NLS-1$
                sb.append(returnType.getShortName());
                sb.append(") newKey;"); //$NON-NLS-1$
            }

            method.addBodyLine(sb.toString());
        }
    }

    if (context.getPlugins().clientInsertMethodGenerated(method,
            topLevelClass, introspectedTable)) {
        topLevelClass.addImportedTypes(importedTypes);
        topLevelClass.addMethod(method);
    }
}
 
开发者ID:bandaotixi,项目名称:generator_mybatis,代码行数:51,代码来源:InsertMethodGenerator.java

示例4: addImplementationElements

import org.mybatis.generator.api.dom.java.PrimitiveTypeWrapper; //导入依赖的package包/类
@Override
public void addImplementationElements(TopLevelClass topLevelClass) {
    Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
    Method method = getMethodShell(importedTypes);

    FullyQualifiedJavaType returnType = method.getReturnType();
    StringBuilder sb = new StringBuilder();

    if (returnType != null) {
        sb.append("Object newKey = "); //$NON-NLS-1$
    }

    sb.append(daoTemplate.getInsertMethod(introspectedTable
            .getIbatis2SqlMapNamespace(), introspectedTable
            .getInsertSelectiveStatementId(), "record")); //$NON-NLS-1$
    method.addBodyLine(sb.toString());

    if (returnType != null) {
        if ("Object".equals(returnType.getShortName())) { //$NON-NLS-1$
            // no need to cast if the return type is Object
            method.addBodyLine("return newKey;"); //$NON-NLS-1$
        } else {
            sb.setLength(0);

            if (returnType.isPrimitive()) {
                PrimitiveTypeWrapper ptw = returnType
                        .getPrimitiveTypeWrapper();
                sb.append("return (("); //$NON-NLS-1$
                sb.append(ptw.getShortName());
                sb.append(") newKey"); //$NON-NLS-1$
                sb.append(")."); //$NON-NLS-1$
                sb.append(ptw.getToPrimitiveMethod());
                sb.append(';');
            } else {
                sb.append("return ("); //$NON-NLS-1$
                sb.append(returnType.getShortName());
                sb.append(") newKey;"); //$NON-NLS-1$
            }

            method.addBodyLine(sb.toString());
        }
    }

    if (context.getPlugins().clientInsertSelectiveMethodGenerated(
            method, topLevelClass, introspectedTable)) {
        topLevelClass.addImportedTypes(importedTypes);
        topLevelClass.addMethod(method);
    }
}
 
开发者ID:bandaotixi,项目名称:generator_mybatis,代码行数:50,代码来源:InsertSelectiveMethodGenerator.java

示例5: addImplementationElements

import org.mybatis.generator.api.dom.java.PrimitiveTypeWrapper; //导入依赖的package包/类
@Override
public void addImplementationElements(TopLevelClass topLevelClass) {
    Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
    Method method = getMethodShell(importedTypes);
    if (generateForJava5) {
        method.addAnnotation("@Override"); //$NON-NLS-1$
    }

    FullyQualifiedJavaType returnType = method.getReturnType();

    StringBuilder sb = new StringBuilder();

    if (returnType != null) {
        sb.append("Object newKey = "); //$NON-NLS-1$
    }

    sb.append(daoTemplate.getInsertMethod(introspectedTable
            .getIbatis2SqlMapNamespace(), introspectedTable
            .getInsertStatementId(), "record")); //$NON-NLS-1$
    method.addBodyLine(sb.toString());

    if (returnType != null) {
        if ("Object".equals(returnType.getShortName())) { //$NON-NLS-1$
            // no need to cast if the return type is Object
            method.addBodyLine("return newKey;"); //$NON-NLS-1$
        } else {
            sb.setLength(0);

            if (returnType.isPrimitive()) {
                PrimitiveTypeWrapper ptw = returnType
                        .getPrimitiveTypeWrapper();
                sb.append("return (("); //$NON-NLS-1$
                sb.append(ptw.getShortName());
                sb.append(") newKey"); //$NON-NLS-1$
                sb.append(")."); //$NON-NLS-1$
                sb.append(ptw.getToPrimitiveMethod());
                sb.append(';');
            } else {
                sb.append("return ("); //$NON-NLS-1$
                sb.append(returnType.getShortName());
                sb.append(") newKey;"); //$NON-NLS-1$
            }

            method.addBodyLine(sb.toString());
        }
    }

    if (context.getPlugins().clientInsertMethodGenerated(method,
            topLevelClass, introspectedTable)) {
        topLevelClass.addImportedTypes(importedTypes);
        topLevelClass.addMethod(method);
    }
}
 
开发者ID:nextyu,项目名称:summer-mybatis-generator,代码行数:54,代码来源:InsertMethodGenerator.java

示例6: addImplementationElements

import org.mybatis.generator.api.dom.java.PrimitiveTypeWrapper; //导入依赖的package包/类
@Override
public void addImplementationElements(TopLevelClass topLevelClass) {
    Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
    Method method = getMethodShell(importedTypes);
    if (generateForJava5) {
        method.addAnnotation("@Override"); //$NON-NLS-1$
    }

    FullyQualifiedJavaType returnType = method.getReturnType();
    StringBuilder sb = new StringBuilder();

    if (returnType != null) {
        sb.append("Object newKey = "); //$NON-NLS-1$
    }

    sb.append(daoTemplate.getInsertMethod(introspectedTable
            .getIbatis2SqlMapNamespace(), introspectedTable
            .getInsertSelectiveStatementId(), "record")); //$NON-NLS-1$
    method.addBodyLine(sb.toString());

    if (returnType != null) {
        if ("Object".equals(returnType.getShortName())) { //$NON-NLS-1$
            // no need to cast if the return type is Object
            method.addBodyLine("return newKey;"); //$NON-NLS-1$
        } else {
            sb.setLength(0);

            if (returnType.isPrimitive()) {
                PrimitiveTypeWrapper ptw = returnType
                        .getPrimitiveTypeWrapper();
                sb.append("return (("); //$NON-NLS-1$
                sb.append(ptw.getShortName());
                sb.append(") newKey"); //$NON-NLS-1$
                sb.append(")."); //$NON-NLS-1$
                sb.append(ptw.getToPrimitiveMethod());
                sb.append(';');
            } else {
                sb.append("return ("); //$NON-NLS-1$
                sb.append(returnType.getShortName());
                sb.append(") newKey;"); //$NON-NLS-1$
            }

            method.addBodyLine(sb.toString());
        }
    }

    if (context.getPlugins().clientInsertSelectiveMethodGenerated(
            method, topLevelClass, introspectedTable)) {
        topLevelClass.addImportedTypes(importedTypes);
        topLevelClass.addMethod(method);
    }
}
 
开发者ID:nextyu,项目名称:summer-mybatis-generator,代码行数:53,代码来源:InsertSelectiveMethodGenerator.java

示例7: addImplementationElements

import org.mybatis.generator.api.dom.java.PrimitiveTypeWrapper; //导入依赖的package包/类
@Override
public void addImplementationElements(TopLevelClass topLevelClass) {
	Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
	Method method = getMethodShell(importedTypes);

	FullyQualifiedJavaType returnType = method.getReturnType();

	StringBuilder sb = new StringBuilder();

	if (returnType != null) {
		sb.append("Object newKey = "); //$NON-NLS-1$
	}

	sb.append(daoTemplate.getInsertMethod(introspectedTable.getIbatis2SqlMapNamespace(),
			introspectedTable.getInsertStatementId(), "record")); //$NON-NLS-1$
	method.addBodyLine(sb.toString());

	if (returnType != null) {
		if ("Object".equals(returnType.getShortName())) { //$NON-NLS-1$
			// no need to cast if the return type is Object
			method.addBodyLine("return newKey;"); //$NON-NLS-1$
		} else {
			sb.setLength(0);

			if (returnType.isPrimitive()) {
				PrimitiveTypeWrapper ptw = returnType.getPrimitiveTypeWrapper();
				sb.append("return (("); //$NON-NLS-1$
				sb.append(ptw.getShortName());
				sb.append(") newKey"); //$NON-NLS-1$
				sb.append(")."); //$NON-NLS-1$
				sb.append(ptw.getToPrimitiveMethod());
				sb.append(';');
			} else {
				sb.append("return ("); //$NON-NLS-1$
				sb.append(returnType.getShortName());
				sb.append(") newKey;"); //$NON-NLS-1$
			}

			method.addBodyLine(sb.toString());
		}
	}

	if (context.getPlugins().clientInsertMethodGenerated(method, topLevelClass, introspectedTable)) {
		topLevelClass.addImportedTypes(importedTypes);
		topLevelClass.addMethod(method);
	}
}
 
开发者ID:fnyexx,项目名称:mybator,代码行数:48,代码来源:InsertMethodGenerator.java

示例8: addImplementationElements

import org.mybatis.generator.api.dom.java.PrimitiveTypeWrapper; //导入依赖的package包/类
@Override
public void addImplementationElements(TopLevelClass topLevelClass) {
	Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
	Method method = getMethodShell(importedTypes);

	FullyQualifiedJavaType returnType = method.getReturnType();
	StringBuilder sb = new StringBuilder();

	if (returnType != null) {
		sb.append("Object newKey = "); //$NON-NLS-1$
	}

	sb.append(daoTemplate.getInsertMethod(introspectedTable.getIbatis2SqlMapNamespace(),
			introspectedTable.getInsertSelectiveStatementId(), "record")); //$NON-NLS-1$
	method.addBodyLine(sb.toString());

	if (returnType != null) {
		if ("Object".equals(returnType.getShortName())) { //$NON-NLS-1$
			// no need to cast if the return type is Object
			method.addBodyLine("return newKey;"); //$NON-NLS-1$
		} else {
			sb.setLength(0);

			if (returnType.isPrimitive()) {
				PrimitiveTypeWrapper ptw = returnType.getPrimitiveTypeWrapper();
				sb.append("return (("); //$NON-NLS-1$
				sb.append(ptw.getShortName());
				sb.append(") newKey"); //$NON-NLS-1$
				sb.append(")."); //$NON-NLS-1$
				sb.append(ptw.getToPrimitiveMethod());
				sb.append(';');
			} else {
				sb.append("return ("); //$NON-NLS-1$
				sb.append(returnType.getShortName());
				sb.append(") newKey;"); //$NON-NLS-1$
			}

			method.addBodyLine(sb.toString());
		}
	}

	if (context.getPlugins().clientInsertSelectiveMethodGenerated(method, topLevelClass, introspectedTable)) {
		topLevelClass.addImportedTypes(importedTypes);
		topLevelClass.addMethod(method);
	}
}
 
开发者ID:fnyexx,项目名称:mybator,代码行数:47,代码来源:InsertSelectiveMethodGenerator.java


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