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


Java IntrospectedColumn.getJavaProperty方法代码示例

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


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

示例1: getJavaBeansField

import org.mybatis.generator.api.IntrospectedColumn; //导入方法依赖的package包/类
/**
 * Gets the java beans field.
 *
 * @param introspectedColumn
 *            the introspected column
 * @param context
 *            the context
 * @param introspectedTable
 *            the introspected table
 * @return the java beans field
 */
public static Field getJavaBeansField(IntrospectedColumn introspectedColumn,
        Context context,
        IntrospectedTable introspectedTable) {
    FullyQualifiedJavaType fqjt = introspectedColumn
            .getFullyQualifiedJavaType();
    String property = introspectedColumn.getJavaProperty();

    Field field = new Field();
    field.setVisibility(JavaVisibility.PRIVATE);
    field.setType(fqjt);
    field.setName(property);
    context.getCommentGenerator().addFieldComment(field,
            introspectedTable, introspectedColumn);

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

示例2: getJavaBeansGetter

import org.mybatis.generator.api.IntrospectedColumn; //导入方法依赖的package包/类
/**
 * Gets the java beans getter.
 *
 * @param introspectedColumn
 *            the introspected column
 * @param context
 *            the context
 * @param introspectedTable
 *            the introspected table
 * @return the java beans getter
 */
public static Method getJavaBeansGetter(IntrospectedColumn introspectedColumn,
        Context context,
        IntrospectedTable introspectedTable) {
    FullyQualifiedJavaType fqjt = introspectedColumn
            .getFullyQualifiedJavaType();
    String property = introspectedColumn.getJavaProperty();

    Method method = new Method();
    method.setVisibility(JavaVisibility.PUBLIC);
    method.setReturnType(fqjt);
    method.setName(getGetterMethodName(property, fqjt));
    context.getCommentGenerator().addGetterComment(method,
            introspectedTable, introspectedColumn);

    StringBuilder sb = new StringBuilder();
    sb.append("return "); //$NON-NLS-1$
    sb.append(property);
    sb.append(';');
    method.addBodyLine(sb.toString());

    return method;
}
 
开发者ID:Yanweichen,项目名称:MybatisGeneatorUtil,代码行数:34,代码来源:JavaBeansUtil.java

示例3: 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:DomKing,项目名称:server-utility,代码行数:47,代码来源:JavaBeansUtil.java

示例4: containsProperty

import org.mybatis.generator.api.IntrospectedColumn; //导入方法依赖的package包/类
public boolean containsProperty(IntrospectedColumn introspectedColumn) {
    if (propertyDescriptors == null) {
        return false;
    }

    boolean found = false;
    String propertyName = introspectedColumn.getJavaProperty();
    String propertyType = introspectedColumn.getFullyQualifiedJavaType()
            .getFullyQualifiedName();

    // get method names from class and check against this column definition.
    // better yet, have a map of method Names. check against it.
    for (int i = 0; i < propertyDescriptors.length; i++) {
        PropertyDescriptor propertyDescriptor = propertyDescriptors[i];

        if (propertyDescriptor.getName().equals(propertyName)) {
            // property name is in the rootClass...

            // Is it the proper type?
            String introspectedPropertyType = propertyDescriptor.getPropertyType().getName();
            if (genericMode && introspectedPropertyType.equals("java.lang.Object")) { //$NON-NLS-1$
                // OK - but add a warning
                warnings.add(getString("Warning.28", //$NON-NLS-1$
                        propertyName, className));
            } else if (!introspectedPropertyType.equals(propertyType)) {
                warnings.add(getString("Warning.21", //$NON-NLS-1$
                        propertyName, className, propertyType));
                break;
            }

            // Does it have a getter?
            if (propertyDescriptor.getReadMethod() == null) {
                warnings.add(getString("Warning.22", //$NON-NLS-1$
                        propertyName, className));
                break;
            }

            // Does it have a setter?
            if (propertyDescriptor.getWriteMethod() == null) {
                warnings.add(getString("Warning.23", //$NON-NLS-1$
                        propertyName, className));
                break;
            }

            found = true;
            break;
        }
    }

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


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