本文整理汇总了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);
}
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
}
示例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(" */");
}
示例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;
}
示例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;
}
示例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$
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
示例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(" */");
}
}
示例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(" */");
}
}