Search in sources :

Example 6 with FullyQualifiedKotlinType

use of org.mybatis.generator.api.dom.kotlin.FullyQualifiedKotlinType in project generator by mybatis.

the class KotlinMapperAndExtensionsGenerator method createMapperInterfaceFile.

protected KotlinFile createMapperInterfaceFile() {
    FullyQualifiedKotlinType type = new FullyQualifiedKotlinType(introspectedTable.getMyBatis3JavaMapperType());
    KotlinFile kf = new KotlinFile(type.getShortNameWithoutTypeArguments());
    kf.setPackage(type.getPackageName());
    return kf;
}
Also used : KotlinFile(org.mybatis.generator.api.dom.kotlin.KotlinFile) FullyQualifiedKotlinType(org.mybatis.generator.api.dom.kotlin.FullyQualifiedKotlinType)

Example 7 with FullyQualifiedKotlinType

use of org.mybatis.generator.api.dom.kotlin.FullyQualifiedKotlinType in project generator by mybatis.

the class KotlinMapperAndExtensionsGenerator method createMapperInterface.

protected KotlinType createMapperInterface(KotlinFile kotlinFile) {
    FullyQualifiedKotlinType type = new FullyQualifiedKotlinType(introspectedTable.getMyBatis3JavaMapperType());
    KotlinType intf = KotlinType.newInterface(type.getShortNameWithoutTypeArguments()).withAnnotation(// $NON-NLS-1$
    "@Mapper").build();
    // $NON-NLS-1$
    kotlinFile.addImport("org.apache.ibatis.annotations.Mapper");
    kotlinFile.addNamedItem(intf);
    context.getCommentGenerator().addFileComment(kotlinFile);
    return intf;
}
Also used : KotlinType(org.mybatis.generator.api.dom.kotlin.KotlinType) FullyQualifiedKotlinType(org.mybatis.generator.api.dom.kotlin.FullyQualifiedKotlinType) FullyQualifiedKotlinType(org.mybatis.generator.api.dom.kotlin.FullyQualifiedKotlinType)

Example 8 with FullyQualifiedKotlinType

use of org.mybatis.generator.api.dom.kotlin.FullyQualifiedKotlinType in project generator by mybatis.

the class KotlinMapperAndExtensionsGenerator method preCalculate.

protected void preCalculate() {
    supportClassGenerator = new KotlinDynamicSqlSupportClassGenerator(context, introspectedTable, warnings);
    recordType = new FullyQualifiedKotlinType(introspectedTable.getKotlinRecordType());
    // $NON-NLS-1$
    resultMapId = recordType.getShortNameWithoutTypeArguments() + "Result";
    fragmentGenerator = new KotlinFragmentGenerator.Builder().withIntrospectedTable(introspectedTable).withResultMapId(resultMapId).withDynamicSqlSupportClassGenerator(supportClassGenerator).withTableFieldName(supportClassGenerator.getTablePropertyName()).build();
    hasGeneratedKeys = introspectedTable.getGeneratedKey().isPresent();
}
Also used : FullyQualifiedKotlinType(org.mybatis.generator.api.dom.kotlin.FullyQualifiedKotlinType)

Aggregations

FullyQualifiedKotlinType (org.mybatis.generator.api.dom.kotlin.FullyQualifiedKotlinType)8 IntrospectedColumn (org.mybatis.generator.api.IntrospectedColumn)2 KotlinFile (org.mybatis.generator.api.dom.kotlin.KotlinFile)2 KotlinProperty (org.mybatis.generator.api.dom.kotlin.KotlinProperty)2 KotlinType (org.mybatis.generator.api.dom.kotlin.KotlinType)2 CommentGenerator (org.mybatis.generator.api.CommentGenerator)1 FullyQualifiedTable (org.mybatis.generator.api.FullyQualifiedTable)1