本文整理汇总了Java中org.mybatis.generator.api.dom.java.InnerClass类的典型用法代码示例。如果您正苦于以下问题:Java InnerClass类的具体用法?Java InnerClass怎么用?Java InnerClass使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
InnerClass类属于org.mybatis.generator.api.dom.java包,在下文中一共展示了InnerClass类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addClassComment
import org.mybatis.generator.api.dom.java.InnerClass; //导入依赖的package包/类
public void addClassComment(InnerClass innerClass, IntrospectedTable introspectedTable, boolean markAsDoNotDelete) {
if (suppressAllComments) {
return;
}
StringBuilder sb = new StringBuilder();
innerClass.addJavaDocLine("/**");
sb.append(" * ");
sb.append(introspectedTable.getFullyQualifiedTable());
innerClass.addJavaDocLine(sb.toString().replace("\n", " "));
sb.setLength(0);
sb.append(" * @author ");
sb.append(systemPro.getProperty("user.name"));
sb.append(" ");
sb.append(currentDateStr);
innerClass.addJavaDocLine(" */");
}
示例2: addClassComment
import org.mybatis.generator.api.dom.java.InnerClass; //导入依赖的package包/类
public void addClassComment(InnerClass innerClass,
IntrospectedTable introspectedTable) {
if (suppressAllComments) {
return;
}
StringBuilder sb = new StringBuilder();
innerClass.addJavaDocLine("/**"); //$NON-NLS-1$
innerClass
.addJavaDocLine(" * This class was generated by MyBatis Generator."); //$NON-NLS-1$
sb.append(" * This class corresponds to the database table "); //$NON-NLS-1$
sb.append(introspectedTable.getFullyQualifiedTable());
innerClass.addJavaDocLine(sb.toString());
addJavadocTag(innerClass, false);
innerClass.addJavaDocLine(" */"); //$NON-NLS-1$
}
示例3: addClassComment
import org.mybatis.generator.api.dom.java.InnerClass; //导入依赖的package包/类
public void addClassComment(InnerClass innerClass,
IntrospectedTable introspectedTable) {
if (suppressAllComments) {
return;
}
StringBuilder sb = new StringBuilder();
innerClass.addJavaDocLine("/**");
innerClass.addJavaDocLine(" * This class was generated by MyBatis Generator.");
sb.append(" * This class corresponds to the database table ");
sb.append(introspectedTable.getFullyQualifiedTable());
innerClass.addJavaDocLine(sb.toString());
addJavadocTag(innerClass, false);
innerClass.addJavaDocLine(" */");
}
示例4: addCurrentMethods
import org.mybatis.generator.api.dom.java.InnerClass; //导入依赖的package包/类
protected void addCurrentMethods(IntrospectedColumn c, InnerClass criteria, String currentType, String currentSqlType){
//EqualTo
criteria.addMethod(createCurrentMethod(c, "and" + toUpperFirst(c.getJavaProperty()) + "EqualToCurrent" + currentType, "=", currentSqlType));
//NotEqualTo
criteria.addMethod(createCurrentMethod(c, "and" + toUpperFirst(c.getJavaProperty()) + "NotEqualToCurrent" + currentType, "<>", currentSqlType));
//GreterThan
criteria.addMethod(createCurrentMethod(c, "and" + toUpperFirst(c.getJavaProperty()) + "GreterThanCurrent" + currentType, ">", currentSqlType));
//GreaterThanOrEqualTo
criteria.addMethod(createCurrentMethod(c, "and" + toUpperFirst(c.getJavaProperty()) + "GreaterThanOrEqualToCurrent" + currentType, ">=", currentSqlType));
//LessThan
criteria.addMethod(createCurrentMethod(c, "and" + toUpperFirst(c.getJavaProperty()) + "LessThanCurrent" + currentType, "<", currentSqlType));
//LessThanOrEqualTo
criteria.addMethod(createCurrentMethod(c, "and" + toUpperFirst(c.getJavaProperty()) + "LessThanOrEqualToCurrent" + currentType, "<=", currentSqlType));
}
示例5: addClassComment
import org.mybatis.generator.api.dom.java.InnerClass; //导入依赖的package包/类
@Override
public void addClassComment(InnerClass innerClass,
IntrospectedTable introspectedTable) {
if (suppressAllComments) {
return;
}
StringBuilder sb = new StringBuilder();
innerClass.addJavaDocLine("/**"); //$NON-NLS-1$
innerClass
.addJavaDocLine(" * This class was generated by MyBatis Generator."); //$NON-NLS-1$
sb.append(" * This class corresponds to the database table "); //$NON-NLS-1$
sb.append(introspectedTable.getFullyQualifiedTable());
innerClass.addJavaDocLine(sb.toString());
addJavadocTag(innerClass, false);
innerClass.addJavaDocLine(" */"); //$NON-NLS-1$
}
示例6: getCriteriaInnerClass
import org.mybatis.generator.api.dom.java.InnerClass; //导入依赖的package包/类
private InnerClass getCriteriaInnerClass(TopLevelClass topLevelClass) {
Method method;
InnerClass answer = new InnerClass(FullyQualifiedJavaType
.getCriteriaInstance());
answer.setVisibility(JavaVisibility.PUBLIC);
answer.setStatic(true);
answer.setSuperClass(FullyQualifiedJavaType
.getGeneratedCriteriaInstance());
context.getCommentGenerator().addClassComment(answer,
introspectedTable, true);
method = new Method();
method.setVisibility(JavaVisibility.PROTECTED);
method.setName("Criteria"); //$NON-NLS-1$
method.setConstructor(true);
method.addBodyLine("super();"); //$NON-NLS-1$
answer.addMethod(method);
return answer;
}
示例7: modelExampleClassGenerated
import org.mybatis.generator.api.dom.java.InnerClass; //导入依赖的package包/类
/**
* 添加给Example类序列化的方法
*
* @param topLevelClass
* @param introspectedTable
* @return
*/
@Override
public boolean modelExampleClassGenerated(TopLevelClass topLevelClass, IntrospectedTable introspectedTable) {
makeSerializable(topLevelClass, introspectedTable);
for (InnerClass innerClass : topLevelClass.getInnerClasses()) {
if ("GeneratedCriteria".equals(innerClass.getType().getShortName())) { //$NON-NLS-1$
innerClass.addSuperInterface(serializable);
}
if ("Criteria".equals(innerClass.getType().getShortName())) { //$NON-NLS-1$
innerClass.addSuperInterface(serializable);
}
if ("Criterion".equals(innerClass.getType().getShortName())) { //$NON-NLS-1$
innerClass.addSuperInterface(serializable);
}
}
return true;
}
示例8: addClassComment
import org.mybatis.generator.api.dom.java.InnerClass; //导入依赖的package包/类
public void addClassComment(InnerClass innerClass, IntrospectedTable introspectedTable, String comment) {
if (suppressAllComments) {
return;
}
StringBuilder sb = new StringBuilder();
String remark = comment;
if (remark != null && remark.length() != 0) {
innerClass.addJavaDocLine("/**"); //$NON-NLS-1$
sb.append(" * "); //$NON-NLS-1$
remark = remark.replaceAll(OutputUtilities.lineSeparator,
"<br>" + OutputUtilities.lineSeparator + "\t * ");
sb.append(remark);
innerClass.addJavaDocLine(sb.toString());
innerClass.addJavaDocLine(" */"); //$NON-NLS-1$
}
}
示例9: getCriteriaInnerClass
import org.mybatis.generator.api.dom.java.InnerClass; //导入依赖的package包/类
private InnerClass getCriteriaInnerClass(TopLevelClass topLevelClass) {
Method method;
InnerClass answer = new InnerClass(FullyQualifiedJavaType.getCriteriaInstance());
answer.setVisibility(JavaVisibility.PUBLIC);
answer.setStatic(true);
answer.setSuperClass(FullyQualifiedJavaType.getGeneratedCriteriaInstance());
context.getCommentGenerator().addClassComment(answer, introspectedTable, true);
method = new Method();
method.setVisibility(JavaVisibility.PROTECTED);
method.setName("Criteria"); //$NON-NLS-1$
method.setConstructor(true);
method.addBodyLine("super();"); //$NON-NLS-1$
answer.addMethod(method);
return answer;
}
示例10: addClassComment
import org.mybatis.generator.api.dom.java.InnerClass; //导入依赖的package包/类
@Override
public void addClassComment(InnerClass innerClass, IntrospectedTable introspectedTable) {
// 类注释,不管用
String shortName = innerClass.getType().getShortName();
innerClass.addJavaDocLine("/**");
//innerClass.addJavaDocLine(" * 类注释");
innerClass.addJavaDocLine(" * " + introspectedTable.getFullyQualifiedTable().getRemark());
innerClass.addJavaDocLine(" * " + shortName);
innerClass.addJavaDocLine(" * 数据库表:" + introspectedTable.getFullyQualifiedTable());
// addJavadocTag(innerClass, false);
innerClass.addJavaDocLine(" */");
}
示例11: modelExampleClassGenerated
import org.mybatis.generator.api.dom.java.InnerClass; //导入依赖的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;
}
示例12: modelExampleClassGenerated
import org.mybatis.generator.api.dom.java.InnerClass; //导入依赖的package包/类
@Override
public boolean modelExampleClassGenerated(TopLevelClass topLevelClass,
IntrospectedTable introspectedTable) {
createToString(topLevelClass);
for(InnerClass ic : topLevelClass.getInnerClasses()){
createToString(ic);
}
return true;
}
示例13: createToString
import org.mybatis.generator.api.dom.java.InnerClass; //导入依赖的package包/类
private void createToString(InnerClass cls){
Method m = new Method();
m.setReturnType(FullyQualifiedJavaType.getStringInstance());
m.setVisibility(JavaVisibility.PUBLIC);
m.setName("toString");
m.addAnnotation("@Override");
StringBuilder sb = new StringBuilder();
sb.append("return \"");
sb.append(cls.getType().getShortName()).append(" [");
int count = 0;
for(Field f : cls.getFields()){
if(!f.isStatic()){
if(count > 0){
sb.append(",");
}
sb.append(f.getName()).append("=\" + ").append(f.getName()).append(" + \"");
count++;
}
}
if(cls.getSuperClass() == null){
sb.append("]\";");
}else{
sb.append("->\" + super.toString() + \"]\";");
}
m.addBodyLine(sb.toString());
cls.addMethod(m);
}
示例14: modelExampleClassGenerated
import org.mybatis.generator.api.dom.java.InnerClass; //导入依赖的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;
}