本文整理汇总了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;
}
示例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;
}