Java Code Examples for org.mybatis.generator.api.dom.java.InnerClass#setFinal()

The following examples show how to use org.mybatis.generator.api.dom.java.InnerClass#setFinal() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DynamicSqlSupportClassGenerator.java    From mapper-generator-javafx with Apache License 2.0 6 votes vote down vote up
private InnerClass buildInnerTableClass(TopLevelClass topLevelClass) {
    FullyQualifiedJavaType fqjt =
            new FullyQualifiedJavaType(introspectedTable.getFullyQualifiedTable().getDomainObjectName());
    InnerClass innerClass = new InnerClass(fqjt.getShortName());
    innerClass.setVisibility(JavaVisibility.PUBLIC);
    innerClass.setStatic(true);
    innerClass.setFinal(true);
    innerClass.setSuperClass(new FullyQualifiedJavaType("org.mybatis.dynamic.sql.SqlTable"));
    
    Method method = new Method(fqjt.getShortName());
    method.setVisibility(JavaVisibility.PUBLIC);
    method.setConstructor(true);
    method.addBodyLine("super(\""
            + escapeStringForJava(introspectedTable.getFullyQualifiedTableNameAtRuntime())
            + "\");");
    innerClass.addMethod(method);
    
    commentGenerator.addClassAnnotation(innerClass, introspectedTable, topLevelClass.getImportedTypes());
    
    return innerClass;
}
 
Example 2
Source File: DynamicSqlSupportClassGenerator.java    From mybatis-generator-plugins with Apache License 2.0 6 votes vote down vote up
private InnerClass buildInnerTableClass(TopLevelClass topLevelClass) {
	FullyQualifiedJavaType fqjt = new FullyQualifiedJavaType(sqlTableClassName);
	InnerClass innerClass = new InnerClass(fqjt.getShortName());
	innerClass.setVisibility(JavaVisibility.PUBLIC);
	innerClass.setStatic(true);
	innerClass.setFinal(true);
	innerClass.setSuperClass(new FullyQualifiedJavaType("org.mybatis.dynamic.sql.SqlTable")); //$NON-NLS-1$

	Method method = new Method(fqjt.getShortName());
	method.setVisibility(JavaVisibility.PUBLIC);
	method.setConstructor(true);
	method.addBodyLine("super(\"" //$NON-NLS-1$
			+ escapeStringForJava(introspectedTable.getFullyQualifiedTableNameAtRuntime()) + "\");"); //$NON-NLS-1$
	innerClass.addMethod(method);

	commentGenerator.addClassAnnotation(innerClass, introspectedTable, topLevelClass.getImportedTypes());

	return innerClass;
}