src/main/java/com/itfsw/mybatis/generator/plugins/ModelCloneablePlugin.java
private void supportCloneable(TopLevelClass topLevelClass, IntrospectedTable introspectedTable) {
        // implement
        topLevelClass.addSuperInterface(new FullyQualifiedJavaType("java.lang.Cloneable"));
        // clone
        Method cloneMethod = JavaElementGeneratorTools.generateMethod(
                "clone",
                JavaVisibility.PUBLIC,
                topLevelClass.getType()
        );
        commentGenerator.addGeneralMethodComment(cloneMethod, introspectedTable);
        cloneMethod.addAnnotation("@Override");
        cloneMethod.addException(new FullyQualifiedJavaType("java.lang.CloneNotSupportedException"));
        cloneMethod.addBodyLine("return (" + topLevelClass.getType().getShortName() + ") super.clone();");
        topLevelClass.addMethod(cloneMethod);
    }
private void supportCloneable(TopLevelClass topLevelClass, IntrospectedTable introspectedTable) {
        // implement
        topLevelClass.addSuperInterface(new FullyQualifiedJavaType("java.lang.Cloneable"));
        // clone
        Method cloneMethod = JavaElementGeneratorTools.generateMethod(
                "clone",
                JavaVisibility.PUBLIC,
                topLevelClass.getType()
        );
        commentGenerator.addGeneralMethodComment(cloneMethod, introspectedTable);
        cloneMethod.addAnnotation("@Override");
        cloneMethod.addException(new FullyQualifiedJavaType("java.lang.CloneNotSupportedException"));
        cloneMethod.addBodyLine("return (" + topLevelClass.getType().getShortName() + ") super.clone();");
        topLevelClass.addMethod(cloneMethod);
    }
private void supportCloneable ( TopLevelClass topLevelClass , IntrospectedTable introspectedTable ) { // implement topLevelClass . addSuperInterface ( new FullyQualifiedJavaType ( "java.lang.Cloneable" ) ) ; // clone Method cloneMethod = JavaElementGeneratorTools . generateMethod ( "clone" , JavaVisibility . PUBLIC , topLevelClass . getType ( ) ) ; commentGenerator . addGeneralMethodComment ( cloneMethod , introspectedTable ) ; cloneMethod . addAnnotation ( "@Override" ) ; cloneMethod . addException ( new FullyQualifiedJavaType ( "java.lang.CloneNotSupportedException" ) ) ; cloneMethod . addBodyLine ( "return (" + topLevelClass . getType ( ) . getShortName ( ) + ") super.clone();" ) ; topLevelClass . addMethod ( cloneMethod ) ; }
支持Cloneable
@param topLevelClass
@param introspectedTable
支持Cloneable