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


Java TopLevelClass.getInnerClasses方法代码示例

本文整理汇总了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;
}
 
开发者ID:ling49043171,项目名称:mark-mybatis-generator,代码行数:34,代码来源:NullIgnoreCriteriaPlugin.java

示例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;
}
 
开发者ID:ling49043171,项目名称:mark-mybatis-generator,代码行数:10,代码来源:ModelToStringPlugin.java

示例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;
}
 
开发者ID:ling49043171,项目名称:mark-mybatis-generator,代码行数:36,代码来源:DBDateCriteriaPlugin.java

示例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;
}
 
开发者ID:bandaotixi,项目名称:generator_mybatis,代码行数:54,代码来源:CaseInsensitiveLikePlugin.java


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