本文整理汇总了Java中org.mybatis.generator.api.dom.java.TopLevelClass.getInnerClasses方法的典型用法代码示例。如果您正苦于以下问题:Java TopLevelClass.getInnerClasses方法的具体用法?Java TopLevelClass.getInnerClasses怎么用?Java TopLevelClass.getInnerClasses使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.mybatis.generator.api.dom.java.TopLevelClass
的用法示例。
在下文中一共展示了TopLevelClass.getInnerClasses方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: modelExampleClassGenerated
import org.mybatis.generator.api.dom.java.TopLevelClass; //导入方法依赖的package包/类
@Override
public boolean modelExampleClassGenerated(TopLevelClass topLevelClass,
IntrospectedTable introspectedTable) {
List<InnerClass> inners = topLevelClass.getInnerClasses();
for(InnerClass in : inners){
if(in.getType().getShortName().startsWith("Generated")
|| in.getType().getShortName().startsWith("Criteria")){
for(Method m : in.getMethods()){
if(m.getName().startsWith("and") && m.getParameters().size() > 0){
m.addBodyLine(0, String.format("if(%s)return (Criteria)this;",getIfExpressionStringBy(m.getParameters())));
}
}
}
if (in.getType().getShortName().startsWith("Criteria")) {
Method method = new Method();
method.setName("setRowNum");
FullyQualifiedJavaType fqjt = FullyQualifiedJavaType.getCriteriaInstance();
method.setReturnType(fqjt);
method.setVisibility(JavaVisibility.PUBLIC);
Parameter p = new Parameter(FullyQualifiedJavaType.getStringInstance(), "rowNum");
method.addParameter(p);
method.addBodyLine(String.format("if(%s)return (Criteria)this;",getIfExpressionStringBy(method.getParameters())));
method.addBodyLine(setRowNum[0]);
method.addBodyLine(setRowNum[1]);
method.addBodyLine(setRowNum[2]);
method.addBodyLine(setRowNum[3]);
method.addBodyLine(setRowNum[4]);
method.addBodyLine("return this;");
in.addMethod(method);
}
}
return true;
}
示例2: modelExampleClassGenerated
import org.mybatis.generator.api.dom.java.TopLevelClass; //导入方法依赖的package包/类
@Override
public boolean modelExampleClassGenerated(TopLevelClass topLevelClass,
IntrospectedTable introspectedTable) {
createToString(topLevelClass);
for(InnerClass ic : topLevelClass.getInnerClasses()){
createToString(ic);
}
return true;
}
示例3: modelExampleClassGenerated
import org.mybatis.generator.api.dom.java.TopLevelClass; //导入方法依赖的package包/类
@Override
public boolean modelExampleClassGenerated(TopLevelClass topLevelClass,
IntrospectedTable introspectedTable) {
InnerClass generatedCriteria = null;
if("GeneratedCriteria".equals(topLevelClass.getType().getShortName())){
generatedCriteria = topLevelClass;
}else{
List<InnerClass> inners = topLevelClass.getInnerClasses();
for(InnerClass in : inners){
if(in.getType().getShortName().startsWith("Generated")){
generatedCriteria = in;
break;
}
}
}
if(generatedCriteria == null){
return true;
}
for(IntrospectedColumn c : introspectedTable.getAllColumns()){
if("Date".equals(c.getFullyQualifiedJavaType().getShortName())){
addCurrentMethods(c,generatedCriteria, "Date", getCurrentDateString());
}else if("Timestamp".equals(c.getFullyQualifiedJavaType().getShortName())){
addCurrentMethods(c,generatedCriteria, "Timestamp", getCurrentTimestampString());
}else if("Time".equals(c.getFullyQualifiedJavaType().getShortName())){
addCurrentMethods(c,generatedCriteria, "Time", getCurrentTimeString());
}
}
return true;
}
示例4: modelExampleClassGenerated
import org.mybatis.generator.api.dom.java.TopLevelClass; //导入方法依赖的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;
}