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


Java IntrospectedColumn.isStringColumn方法代码示例

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


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

示例1: 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

示例2: modelExampleClassGenerated

import org.mybatis.generator.api.IntrospectedColumn; //导入方法依赖的package包/类
@Override
public boolean modelExampleClassGenerated(TopLevelClass topLevelClass,
        IntrospectedTable introspectedTable) {

    InnerClass criteria = null;
    // first, find the Criteria inner class
    for (InnerClass innerClass : topLevelClass.getInnerClasses()) {
        if ("GeneratedCriteria".equals(innerClass.getType().getShortName())) { //$NON-NLS-1$
            criteria = innerClass;
            break;
        }
    }

    if (criteria == null) {
        // can't find the inner class for some reason, bail out.
        return true;
    }

    for (IntrospectedColumn introspectedColumn : introspectedTable
            .getNonBLOBColumns()) {
        if (!introspectedColumn.isJdbcCharacterColumn()
                || !introspectedColumn.isStringColumn()) {
            continue;
        }

        Method method = new Method();
        method.setVisibility(JavaVisibility.PUBLIC);
        method.addParameter(new Parameter(introspectedColumn
                .getFullyQualifiedJavaType(), "value")); //$NON-NLS-1$

        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("LikeInsensitive"); //$NON-NLS-1$
        method.setName(sb.toString());
        method.setReturnType(FullyQualifiedJavaType.getCriteriaInstance());

        sb.setLength(0);
        sb.append("addCriterion(\"upper("); //$NON-NLS-1$
        sb.append(Ibatis2FormattingUtilities
                .getAliasedActualColumnName(introspectedColumn));
        sb.append(") like\", value.toUpperCase(), \""); //$NON-NLS-1$
        sb.append(introspectedColumn.getJavaProperty());
        sb.append("\");"); //$NON-NLS-1$
        method.addBodyLine(sb.toString());
        method.addBodyLine("return (Criteria) this;"); //$NON-NLS-1$

        criteria.addMethod(method);
    }

    return true;
}
 
开发者ID:bandaotixi,项目名称:generator_mybatis,代码行数:54,代码来源:CaseInsensitiveLikePlugin.java


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