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


Java Field类代码示例

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


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

示例1: makeSerializable

import org.mybatis.generator.api.dom.java.Field; //导入依赖的package包/类
protected void makeSerializable(TopLevelClass topLevelClass,
        IntrospectedTable introspectedTable) {
    if (addGWTInterface) {
        topLevelClass.addImportedType(gwtSerializable);
        topLevelClass.addSuperInterface(gwtSerializable);
    }
    
    if (!suppressJavaInterface) {
        topLevelClass.addImportedType(serializable);
        topLevelClass.addSuperInterface(serializable);

        Field field = new Field();
        field.setFinal(true);
        field.setInitializationString("1L"); //$NON-NLS-1$
        field.setName("serialVersionUID"); //$NON-NLS-1$
        field.setStatic(true);
        field.setType(new FullyQualifiedJavaType("long")); //$NON-NLS-1$
        field.setVisibility(JavaVisibility.PRIVATE);
        context.getCommentGenerator().addFieldComment(field, introspectedTable);

        topLevelClass.addField(field);
    }
}
 
开发者ID:nextyu,项目名称:summer-mybatis-generator,代码行数:24,代码来源:SerializablePlugin.java

示例2: modelFieldGenerated

import org.mybatis.generator.api.dom.java.Field; //导入依赖的package包/类
public boolean modelFieldGenerated(Field field,
        TopLevelClass topLevelClass, IntrospectedColumn introspectedColumn,
        IntrospectedTable introspectedTable,
        Plugin.ModelClassType modelClassType) {
    boolean rc = true;

    for (Plugin plugin : plugins) {
        if (!plugin.modelFieldGenerated(field, topLevelClass,
                introspectedColumn, introspectedTable, modelClassType)) {
            rc = false;
            break;
        }
    }

    return rc;
}
 
开发者ID:bandaotixi,项目名称:generator_mybatis,代码行数:17,代码来源:PluginAggregator.java

示例3: getJavaBeansField

import org.mybatis.generator.api.dom.java.Field; //导入依赖的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

示例4: getFieldClones

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

        field.setInitializationString(oldField.getInitializationString());
        field.setFinal(oldField.isFinal());
        field.setStatic(oldField.isStatic());
        field.setName(oldField.getName());
        field.setType(oldField.getType());
        field.setVisibility(oldField.getVisibility());
        commentGenerator.addFieldComment(field, introspectedTable);
        answer.add(field);
    }

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

示例5: makeSerializable

import org.mybatis.generator.api.dom.java.Field; //导入依赖的package包/类
protected void makeSerializable(TopLevelClass topLevelClass,
                                IntrospectedTable introspectedTable) {
    if (addGWTInterface) {
        topLevelClass.addImportedType(gwtSerializable);
        topLevelClass.addSuperInterface(gwtSerializable);
    }

    if (!suppressJavaInterface) {
        topLevelClass.addImportedType(serializable);
        topLevelClass.addSuperInterface(serializable);

        Field field = new Field();
        field.setFinal(true);
        field.setInitializationString("1L");
        field.setName(SERIAL_VERSION_UID);
        field.setStatic(true);
        field.setType(new FullyQualifiedJavaType("long"));
        field.setVisibility(JavaVisibility.PRIVATE);
        context.getCommentGenerator().addFieldComment(field, introspectedTable);

        topLevelClass.addField(field);
    }
}
 
开发者ID:drtrang,项目名称:mybatis-generator-extension,代码行数:24,代码来源:SerializablePlugin.java

示例6: addFieldComment

import org.mybatis.generator.api.dom.java.Field; //导入依赖的package包/类
public void addFieldComment(Field field, IntrospectedTable introspectedTable) {
    if (suppressAllComments) {
        return;
    }

    StringBuilder sb = new StringBuilder();

    field.addJavaDocLine("/**"); 
    field
            .addJavaDocLine(" * This field was generated by MyBatis Generator."); 

    sb.append(" * This field corresponds to the database table "); 
    sb.append(introspectedTable.getFullyQualifiedTable());
    field.addJavaDocLine(sb.toString());

    addJavadocTag(field, false);

    field.addJavaDocLine(" */"); 
}
 
开发者ID:xiachengwei5,项目名称:org.mybatis.generator.core-1.3.5,代码行数:20,代码来源:DefaultCommentGenerator.java

示例7: modelFieldGenerated

import org.mybatis.generator.api.dom.java.Field; //导入依赖的package包/类
@Override
public boolean modelFieldGenerated(Field field,
        TopLevelClass topLevelClass, IntrospectedColumn introspectedColumn,
        IntrospectedTable introspectedTable,
        Plugin.ModelClassType modelClassType) {
    boolean rc = true;

    for (Plugin plugin : plugins) {
        if (!plugin.modelFieldGenerated(field, topLevelClass,
                introspectedColumn, introspectedTable, modelClassType)) {
            rc = false;
            break;
        }
    }

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

示例8: AbstractDAOTemplate

import org.mybatis.generator.api.dom.java.Field; //导入依赖的package包/类
/**
 * Instantiates a new abstract dao template.
 */
public AbstractDAOTemplate() {
    super();
    interfaceImports = new ArrayList<FullyQualifiedJavaType>();
    implementationImports = new ArrayList<FullyQualifiedJavaType>();
    fields = new ArrayList<Field>();
    methods = new ArrayList<Method>();
    checkedExceptions = new ArrayList<FullyQualifiedJavaType>();
    configured = false;
}
 
开发者ID:DomKing,项目名称:springbootWeb,代码行数:13,代码来源:AbstractDAOTemplate.java

示例9: addFieldComment

import org.mybatis.generator.api.dom.java.Field; //导入依赖的package包/类
public void addFieldComment(Field field,
        IntrospectedTable introspectedTable,
        IntrospectedColumn introspectedColumn) {
    if (suppressAllComments) {
        return;
    }

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

    String remarks = introspectedColumn.getRemarks();
    if (addRemarkComments && StringUtility.stringHasValue(remarks)) {
        field.addJavaDocLine(" * Database Column Remarks:");
        String[] remarkLines = remarks.split(System.getProperty("line.separator"));  //$NON-NLS-1$
        for (String remarkLine : remarkLines) {
            field.addJavaDocLine(" *   " + remarkLine);  //$NON-NLS-1$
        }
    }

    field.addJavaDocLine(" *"); //$NON-NLS-1$
    field
            .addJavaDocLine(" * This field was generated by MyBatis Generator."); //$NON-NLS-1$

    StringBuilder sb = new StringBuilder();
    sb.append(" * This field corresponds to the database column "); //$NON-NLS-1$
    sb.append(introspectedTable.getFullyQualifiedTable());
    sb.append('.');
    sb.append(introspectedColumn.getActualColumnName());
    field.addJavaDocLine(sb.toString());

    addJavadocTag(field, false);

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

示例10: generateToString

import org.mybatis.generator.api.dom.java.Field; //导入依赖的package包/类
private void generateToString(IntrospectedTable introspectedTable, TopLevelClass topLevelClass) {
        Method method = new Method();
        method.setVisibility(JavaVisibility.PUBLIC);
        method.setReturnType(FullyQualifiedJavaType.getStringInstance());
        method.setName("toString");
        if(introspectedTable.isJava5Targeted()) {
            method.addAnnotation("@Override");
        }

        this.context.getCommentGenerator().addGeneralMethodComment(method, introspectedTable);
        method.addBodyLine("StringBuilder sb = new StringBuilder();");
        method.addBodyLine("sb.append(getClass().getSimpleName());");
        method.addBodyLine("sb.append(\" [\");");
//        method.addBodyLine("sb.append(\"Hash = \").append(hashCode());");
        StringBuilder sb = new StringBuilder();
        Iterator var5 = topLevelClass.getFields().iterator();

        while(var5.hasNext()) {
            Field field = (Field)var5.next();
            String property = field.getName();
            sb.setLength(0);
            sb.append("sb.append(\"").append(", ").append(property).append("=\")").append(".append(").append(property).append(");");
            method.addBodyLine(sb.toString());
        }

        method.addBodyLine("sb.append(\"]\");");
//        if(this.useToStringFromRoot && topLevelClass.getSuperClass() != null) {
//            method.addBodyLine("sb.append(\", from super class \");");
//            method.addBodyLine("sb.append(super.toString());");
//        }

        method.addBodyLine("return sb.toString();");
        topLevelClass.addMethod(method);
    }
 
开发者ID:ychaoyang,项目名称:autotest,代码行数:35,代码来源:ToStringPlugin.java

示例11: getGetter

import org.mybatis.generator.api.dom.java.Field; //导入依赖的package包/类
public static Method getGetter(Field field) {
    Method method = new Method();
    method.setName(getGetterMethodName(field.getName(), field
            .getType()));
    method.setReturnType(field.getType());
    method.setVisibility(JavaVisibility.PUBLIC);
    StringBuilder sb = new StringBuilder();
    sb.append("return "); //$NON-NLS-1$
    sb.append(field.getName());
    sb.append(';');
    method.addBodyLine(sb.toString());
    return method;
}
 
开发者ID:DomKing,项目名称:springbootWeb,代码行数:14,代码来源:AbstractJavaGenerator.java

示例12: generateToString

import org.mybatis.generator.api.dom.java.Field; //导入依赖的package包/类
private void generateToString(IntrospectedTable introspectedTable,
        TopLevelClass topLevelClass) {
    Method method = new Method();
    method.setVisibility(JavaVisibility.PUBLIC);
    method.setReturnType(FullyQualifiedJavaType.getStringInstance());
    method.setName("toString"); //$NON-NLS-1$
    if (introspectedTable.isJava5Targeted()) {
        method.addAnnotation("@Override"); //$NON-NLS-1$
    }

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

    method.addBodyLine("StringBuilder sb = new StringBuilder();"); //$NON-NLS-1$
    method.addBodyLine("sb.append(getClass().getSimpleName());"); //$NON-NLS-1$
    method.addBodyLine("sb.append(\" [\");"); //$NON-NLS-1$
    method.addBodyLine("sb.append(\"Hash = \").append(hashCode());"); //$NON-NLS-1$
    StringBuilder sb = new StringBuilder();
    for (Field field : topLevelClass.getFields()) {
        String property = field.getName();
        sb.setLength(0);
        sb.append("sb.append(\"").append(", ").append(property) //$NON-NLS-1$ //$NON-NLS-2$
                .append("=\")").append(".append(").append(property) //$NON-NLS-1$ //$NON-NLS-2$
                .append(");"); //$NON-NLS-1$
        method.addBodyLine(sb.toString());
    }

    method.addBodyLine("sb.append(\"]\");"); //$NON-NLS-1$
    if (useToStringFromRoot && topLevelClass.getSuperClass() != null) {
        method.addBodyLine("sb.append(\", from super class \");"); //$NON-NLS-1$
        method.addBodyLine("sb.append(super.toString());"); //$NON-NLS-1$
    }
    method.addBodyLine("return sb.toString();"); //$NON-NLS-1$

    topLevelClass.addMethod(method);
}
 
开发者ID:nextyu,项目名称:summer-mybatis-generator,代码行数:37,代码来源:ToStringPlugin.java

示例13: configureFields

import org.mybatis.generator.api.dom.java.Field; //导入依赖的package包/类
@Override
protected void configureFields() {
    Field field = new Field();
    field.setVisibility(JavaVisibility.PRIVATE);
    field.setType(sqlMapClientType);
    field.setName("sqlMapClient"); //$NON-NLS-1$
    addField(field);
}
 
开发者ID:DomKing,项目名称:server-utility,代码行数:9,代码来源:GenericSIDAOTemplate.java

示例14: addFieldComment

import org.mybatis.generator.api.dom.java.Field; //导入依赖的package包/类
@Override
public void addFieldComment(Field field, IntrospectedTable introspectedTable, IntrospectedColumn introspectedColumn) {
	super.addFieldComment(field, introspectedTable, introspectedColumn);
	if (introspectedColumn.getRemarks() != null && !introspectedColumn.getRemarks().equals("")) {
		field.addJavaDocLine("/**");
		field.addJavaDocLine(" * " + introspectedColumn.getRemarks());
		addJavadocTag(field, false);
		field.addJavaDocLine(" */");
	}
}
 
开发者ID:youngMen1,项目名称:-Spring-SpringMVC-Mybatis-,代码行数:11,代码来源:CommentGenerator.java

示例15: addFieldComment

import org.mybatis.generator.api.dom.java.Field; //导入依赖的package包/类
@Override
public void addFieldComment(Field field, IntrospectedTable introspectedTable, IntrospectedColumn introspectedColumn) {
	super.addFieldComment(field, introspectedTable, introspectedColumn);
	if (introspectedColumn.getRemarks() != null && !"".equals(introspectedColumn.getRemarks())) {
		field.addJavaDocLine("/**");
		field.addJavaDocLine(" * " + introspectedColumn.getRemarks());
		addJavadocTag(field, false);
		field.addJavaDocLine(" */");
	}
}
 
开发者ID:ChangyiHuang,项目名称:shuzheng,代码行数:11,代码来源:CommentGenerator.java


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