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


Java IntrospectedColumn类代码示例

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


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

示例1: addSetterComment

import org.mybatis.generator.api.IntrospectedColumn; //导入依赖的package包/类
public void addSetterComment(Method method, IntrospectedTable introspectedTable,
        IntrospectedColumn introspectedColumn) {
    if (suppressAllComments) {
        return;
    }
    method.addJavaDocLine("/**");
    StringBuilder sb = new StringBuilder();
    sb.append(" * ");
    sb.append(introspectedColumn.getRemarks());
    method.addJavaDocLine(sb.toString().replace("\n", " "));
    Parameter parm = method.getParameters().get(0);
    sb.setLength(0);
    sb.append(" * @param ");
    sb.append(parm.getName());
    sb.append(" ");
    sb.append(introspectedColumn.getRemarks());
    method.addJavaDocLine(sb.toString().replace("\n", " "));
    method.addJavaDocLine(" */");
}
 
开发者ID:xiachuanshou,项目名称:shop-manager,代码行数:20,代码来源:MyCommentGenerator.java

示例2: addGetterComment

import org.mybatis.generator.api.IntrospectedColumn; //导入依赖的package包/类
public void addGetterComment(Method method, IntrospectedTable introspectedTable, IntrospectedColumn introspectedColumn) {
    if (!this.suppressAllComments) {
        StringBuilder sb = new StringBuilder();
        method.addJavaDocLine("/**");
        method.addJavaDocLine(" * This method was generated by MyBatis Generator.");
        sb.append(" * This method returns the value of the database column ");
        sb.append(introspectedTable.getFullyQualifiedTable());
        sb.append('.');
        sb.append(introspectedColumn.getActualColumnName());
        method.addJavaDocLine(sb.toString());
        method.addJavaDocLine(" *");
        sb.setLength(0);
        sb.append(" * @return the value of ");
        sb.append(introspectedTable.getFullyQualifiedTable());
        sb.append('.');
        sb.append(introspectedColumn.getActualColumnName());
        method.addJavaDocLine(sb.toString());
        this.addJavadocTag(method, false);
        method.addJavaDocLine(" */");
    }
}
 
开发者ID:ychaoyang,项目名称:autotest,代码行数:22,代码来源:DefaultCommentGenerator.java

示例3: getParameterClause

import org.mybatis.generator.api.IntrospectedColumn; //导入依赖的package包/类
/**
 * Gets the parameter clause.
 *
 * @param introspectedColumn
 *            the introspected column
 * @param prefix
 *            the prefix
 * @return the parameter clause
 */
public static String getParameterClause(
        IntrospectedColumn introspectedColumn, String prefix) {
    StringBuilder sb = new StringBuilder();

    sb.append('#');
    sb.append(introspectedColumn.getJavaProperty(prefix));

    if (stringHasValue(introspectedColumn.getTypeHandler())) {
        sb.append(",jdbcType="); //$NON-NLS-1$
        sb.append(introspectedColumn.getJdbcTypeName());
        sb.append(",handler="); //$NON-NLS-1$
        sb.append(introspectedColumn.getTypeHandler());
    } else {
        sb.append(':');
        sb.append(introspectedColumn.getJdbcTypeName());
    }

    sb.append('#');

    return sb.toString();
}
 
开发者ID:Yanweichen,项目名称:MybatisGeneatorUtil,代码行数:31,代码来源:Ibatis2FormattingUtilities.java

示例4: addGeneratedKeyAnnotation

import org.mybatis.generator.api.IntrospectedColumn; //导入依赖的package包/类
protected void addGeneratedKeyAnnotation(Method method, GeneratedKey gk) {
    StringBuilder sb = new StringBuilder();
    IntrospectedColumn introspectedColumn = introspectedTable.getColumn(gk.getColumn());
    if (introspectedColumn != null) {
        if (gk.isJdbcStandard()) {
            sb.append("@Options(useGeneratedKeys=true,keyProperty=\""); //$NON-NLS-1$
            sb.append(introspectedColumn.getJavaProperty());
            sb.append("\")"); //$NON-NLS-1$
            method.addAnnotation(sb.toString());
        } else {
            FullyQualifiedJavaType fqjt = introspectedColumn.getFullyQualifiedJavaType();
            sb.append("@SelectKey(statement=\""); //$NON-NLS-1$
            sb.append(gk.getRuntimeSqlStatement());
            sb.append("\", keyProperty=\""); //$NON-NLS-1$
            sb.append(introspectedColumn.getJavaProperty());
            sb.append("\", before="); //$NON-NLS-1$
            sb.append(gk.isIdentity() ? "false" : "true"); //$NON-NLS-1$ //$NON-NLS-2$
            sb.append(", resultType="); //$NON-NLS-1$
            sb.append(fqjt.getShortName());
            sb.append(".class)"); //$NON-NLS-1$
            method.addAnnotation(sb.toString());
        }
    }
}
 
开发者ID:Yanweichen,项目名称:MybatisGeneatorUtil,代码行数:25,代码来源:AbstractJavaMapperMethodGenerator.java

示例5: calculateIdentityColumns

import org.mybatis.generator.api.IntrospectedColumn; //导入依赖的package包/类
/**
 * Calculate identity columns.
 *
 * @param tc
 *            the tc
 * @param columns
 *            the columns
 */
private void calculateIdentityColumns(TableConfiguration tc,
        Map<ActualTableName, List<IntrospectedColumn>> columns) {
    GeneratedKey gk = tc.getGeneratedKey();
    if (gk == null) {
        // no generated key, then no identity or sequence columns
        return;
    }
    
    for (Map.Entry<ActualTableName, List<IntrospectedColumn>> entry : columns
            .entrySet()) {
        for (IntrospectedColumn introspectedColumn : entry.getValue()) {
            if (isMatchedColumn(introspectedColumn, gk)) {
                if (gk.isIdentity() || gk.isJdbcStandard()) {
                    introspectedColumn.setIdentity(true);
                    introspectedColumn.setSequenceColumn(false);
                } else {
                    introspectedColumn.setIdentity(false);
                    introspectedColumn.setSequenceColumn(true);
                }
            }
        }
    }
}
 
开发者ID:Yanweichen,项目名称:MybatisGeneatorUtil,代码行数:32,代码来源:DatabaseIntrospector.java

示例6: getSelectKey

import org.mybatis.generator.api.IntrospectedColumn; //导入依赖的package包/类
/**
 * This method should return an XmlElement for the select key used to
 * automatically generate keys.
 * 
 * @param introspectedColumn
 *            the column related to the select key statement
 * @param generatedKey
 *            the generated key for the current table
 * @return the selectKey element
 */
protected XmlElement getSelectKey(IntrospectedColumn introspectedColumn,
        GeneratedKey generatedKey) {
    String identityColumnType = introspectedColumn
            .getFullyQualifiedJavaType().getFullyQualifiedName();

    XmlElement answer = new XmlElement("selectKey"); //$NON-NLS-1$
    answer.addAttribute(new Attribute("resultType", identityColumnType)); //$NON-NLS-1$
    answer.addAttribute(new Attribute(
            "keyProperty", introspectedColumn.getJavaProperty())); //$NON-NLS-1$
    answer.addAttribute(new Attribute("order", //$NON-NLS-1$
            generatedKey.getMyBatis3Order())); 
    
    answer.addElement(new TextElement(generatedKey
                    .getRuntimeSqlStatement()));

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

示例7: calculateJdbcTypeName

import org.mybatis.generator.api.IntrospectedColumn; //导入依赖的package包/类
public String calculateJdbcTypeName(IntrospectedColumn introspectedColumn) {
	String answer;
	JdbcTypeInformation jdbcTypeInformation = typeMap
			.get(introspectedColumn.getJdbcType());

	if (jdbcTypeInformation == null) {
		switch (introspectedColumn.getJdbcType()) {
		case Types.DECIMAL:
			answer = "DECIMAL"; //$NON-NLS-1$
			break;
		case Types.NUMERIC:
			answer = "NUMERIC"; //$NON-NLS-1$
			break;
		default:
			answer = null;
			break;
		}
	} else {
		answer = jdbcTypeInformation.getJdbcTypeName();
	}

	return answer;
}
 
开发者ID:ling49043171,项目名称:mark-mybatis-generator,代码行数:24,代码来源:DB2JavaTypeResolver.java

示例8: getParameterClause

import org.mybatis.generator.api.IntrospectedColumn; //导入依赖的package包/类
/**
 * Gets the parameter clause.
 *
 * @param introspectedColumn
 *            the introspected column
 * @param prefix
 *            the prefix
 * @return the parameter clause
 */
public static String getParameterClause(
        IntrospectedColumn introspectedColumn, String prefix) {
    StringBuilder sb = new StringBuilder();

    sb.append("#{"); //$NON-NLS-1$
    sb.append(introspectedColumn.getJavaProperty(prefix));
    sb.append(",jdbcType="); //$NON-NLS-1$
    sb.append(introspectedColumn.getJdbcTypeName());

    if (stringHasValue(introspectedColumn.getTypeHandler())) {
        sb.append(",typeHandler="); //$NON-NLS-1$
        sb.append(introspectedColumn.getTypeHandler());
    }

    sb.append('}');

    return sb.toString();
}
 
开发者ID:bandaotixi,项目名称:generator_mybatis,代码行数:28,代码来源:MyBatis3FormattingUtilities.java

示例9: getNoValueMethod

import org.mybatis.generator.api.IntrospectedColumn; //导入依赖的package包/类
private Method getNoValueMethod(IntrospectedColumn introspectedColumn,
        String nameFragment, String operator) {
    Method method = new Method();
    method.setVisibility(JavaVisibility.PUBLIC);
    StringBuilder sb = new StringBuilder();
    sb.append(introspectedColumn.getJavaProperty());
    sb.setCharAt(0, Character.toUpperCase(sb.charAt(0)));
    sb.insert(0, "and"); //$NON-NLS-1$
    sb.append(nameFragment);
    method.setName(sb.toString());
    method.setReturnType(FullyQualifiedJavaType.getCriteriaInstance());
    sb.setLength(0);
    sb.append("addCriterion(\""); //$NON-NLS-1$
    sb.append(Ibatis2FormattingUtilities
            .getAliasedActualColumnName(introspectedColumn));
    sb.append(' ');
    sb.append(operator);
    sb.append("\");"); //$NON-NLS-1$
    method.addBodyLine(sb.toString());
    method.addBodyLine("return (Criteria) this;"); //$NON-NLS-1$

    return method;
}
 
开发者ID:DomKing,项目名称:server-utility,代码行数:24,代码来源:ExampleGenerator.java

示例10: addParameterizedConstructor

import org.mybatis.generator.api.IntrospectedColumn; //导入依赖的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:bandaotixi,项目名称:generator_mybatis,代码行数:24,代码来源:PrimaryKeyGenerator.java

示例11: addElements

import org.mybatis.generator.api.IntrospectedColumn; //导入依赖的package包/类
@Override
public void addElements(XmlElement parentElement) {
    XmlElement answer = new XmlElement("sql"); //$NON-NLS-1$

    answer.addAttribute(new Attribute("id", //$NON-NLS-1$
            introspectedTable.getBaseColumnListId()));

    context.getCommentGenerator().addComment(answer);

    StringBuilder sb = new StringBuilder();
    Iterator<IntrospectedColumn> iter = introspectedTable
            .getNonBLOBColumns().iterator();
    while (iter.hasNext()) {
        sb.append(MyBatis3FormattingUtilities.getSelectListPhrase(iter
                .next()));

        if (iter.hasNext()) {
            sb.append(", "); //$NON-NLS-1$
        }

        if (sb.length() > 80) {
            answer.addElement(new TextElement(sb.toString()));
            sb.setLength(0);
        }
    }

    if (sb.length() > 0) {
        answer.addElement(new TextElement(sb.toString()));
    }

    if (context.getPlugins().sqlMapBaseColumnListElementGenerated(
            answer, introspectedTable)) {
        parentElement.addElement(answer);
    }
}
 
开发者ID:Yanweichen,项目名称:MybatisGeneatorUtil,代码行数:36,代码来源:BaseColumnListElementGenerator.java

示例12: addSetterComment

import org.mybatis.generator.api.IntrospectedColumn; //导入依赖的package包/类
public void addSetterComment(Method method,
        IntrospectedTable introspectedTable,
        IntrospectedColumn introspectedColumn) {
    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 sets the value of the database column "); //$NON-NLS-1$
    sb.append(introspectedTable.getFullyQualifiedTable());
    sb.append('.');
    sb.append(introspectedColumn.getActualColumnName());
    method.addJavaDocLine(sb.toString());

    method.addJavaDocLine(" *"); //$NON-NLS-1$

    Parameter parm = method.getParameters().get(0);
    sb.setLength(0);
    sb.append(" * @param "); //$NON-NLS-1$
    sb.append(parm.getName());
    sb.append(" the value for "); //$NON-NLS-1$
    sb.append(introspectedTable.getFullyQualifiedTable());
    sb.append('.');
    sb.append(introspectedColumn.getActualColumnName());
    method.addJavaDocLine(sb.toString());

    addJavadocTag(method, false);

    method.addJavaDocLine(" */"); //$NON-NLS-1$
}
 
开发者ID:DomKing,项目名称:server-utility,代码行数:36,代码来源:DefaultCommentGenerator.java

示例13: getMethodShell

import org.mybatis.generator.api.IntrospectedColumn; //导入依赖的package包/类
private Method getMethodShell(Set<FullyQualifiedJavaType> importedTypes) {
    Method method = new Method();

    FullyQualifiedJavaType returnType;
    if (introspectedTable.getGeneratedKey() != null) {
        IntrospectedColumn introspectedColumn = introspectedTable
                .getColumn(introspectedTable.getGeneratedKey().getColumn());
        if (introspectedColumn == null) {
            // the specified column doesn't exist, so don't do the generated
            // key
            // (the warning has already been reported)
            returnType = null;
        } else {
            returnType = introspectedColumn.getFullyQualifiedJavaType();
            importedTypes.add(returnType);
        }
    } else {
        returnType = null;
    }
    method.setReturnType(returnType);
    method.setVisibility(JavaVisibility.PUBLIC);
    method.setName(getDAOMethodNameCalculator()
            .getInsertSelectiveMethodName(introspectedTable));

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

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

    for (FullyQualifiedJavaType fqjt : daoTemplate.getCheckedExceptions()) {
        method.addException(fqjt);
        importedTypes.add(fqjt);
    }

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

    return method;
}
 
开发者ID:DomKing,项目名称:server-utility,代码行数:41,代码来源:InsertSelectiveMethodGenerator.java

示例14: calculateJdbcTypeName

import org.mybatis.generator.api.IntrospectedColumn; //导入依赖的package包/类
@Override
public String calculateJdbcTypeName(IntrospectedColumn introspectedColumn) {
    String answer = null;
    JdbcTypeInformation jdbcTypeInformation = typeMap
            .get(introspectedColumn.getJdbcType());

    if (jdbcTypeInformation != null) {
        answer = jdbcTypeInformation.getJdbcTypeName();
    }

    return answer;
}
 
开发者ID:nextyu,项目名称:summer-mybatis-generator,代码行数:13,代码来源:JavaTypeResolverDefaultImpl.java

示例15: getJavaBeansSetter

import org.mybatis.generator.api.IntrospectedColumn; //导入依赖的package包/类
/**
 * 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 (introspectedColumn.isStringColumn() && isTrimStringsEnabled(introspectedColumn)) {
        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;
}
 
开发者ID:bandaotixi,项目名称:generator_mybatis,代码行数:47,代码来源:JavaBeansUtil.java


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