use of org.mybatis.generator.api.dom.java.FullyQualifiedJavaType in project generator by mybatis.
the class AnnotatedSelectByExampleWithBLOBsMethodGenerator method addMapperAnnotations.
@Override
public void addMapperAnnotations(Interface interfaze, Method method) {
FullyQualifiedJavaType fqjt = new FullyQualifiedJavaType(introspectedTable.getMyBatis3SqlProviderType());
StringBuilder sb = new StringBuilder();
//$NON-NLS-1$
sb.append("@SelectProvider(type=");
sb.append(fqjt.getShortName());
//$NON-NLS-1$
sb.append(".class, method=\"");
sb.append(introspectedTable.getSelectByExampleWithBLOBsStatementId());
//$NON-NLS-1$
sb.append("\")");
method.addAnnotation(sb.toString());
if (introspectedTable.isConstructorBased()) {
//$NON-NLS-1$
method.addAnnotation("@ConstructorArgs({");
} else {
//$NON-NLS-1$
method.addAnnotation("@Results({");
}
Iterator<IntrospectedColumn> iterPk = introspectedTable.getPrimaryKeyColumns().iterator();
Iterator<IntrospectedColumn> iterNonPk = introspectedTable.getNonPrimaryKeyColumns().iterator();
while (iterPk.hasNext()) {
IntrospectedColumn introspectedColumn = iterPk.next();
sb.setLength(0);
javaIndent(sb, 1);
sb.append(getResultAnnotation(interfaze, introspectedColumn, true, introspectedTable.isConstructorBased()));
if (iterPk.hasNext() || iterNonPk.hasNext()) {
sb.append(',');
}
method.addAnnotation(sb.toString());
}
while (iterNonPk.hasNext()) {
IntrospectedColumn introspectedColumn = iterNonPk.next();
sb.setLength(0);
javaIndent(sb, 1);
sb.append(getResultAnnotation(interfaze, introspectedColumn, false, introspectedTable.isConstructorBased()));
if (iterNonPk.hasNext()) {
sb.append(',');
}
method.addAnnotation(sb.toString());
}
//$NON-NLS-1$
method.addAnnotation("})");
}
use of org.mybatis.generator.api.dom.java.FullyQualifiedJavaType in project generator by mybatis.
the class AnnotatedSelectByExampleWithBLOBsMethodGenerator method addExtraImports.
@Override
public void addExtraImports(Interface interfaze) {
//$NON-NLS-1$
interfaze.addImportedType(new FullyQualifiedJavaType("org.apache.ibatis.annotations.SelectProvider"));
//$NON-NLS-1$
interfaze.addImportedType(new FullyQualifiedJavaType("org.apache.ibatis.type.JdbcType"));
if (introspectedTable.isConstructorBased()) {
//$NON-NLS-1$
interfaze.addImportedType(new FullyQualifiedJavaType("org.apache.ibatis.annotations.Arg"));
//$NON-NLS-1$
interfaze.addImportedType(new FullyQualifiedJavaType("org.apache.ibatis.annotations.ConstructorArgs"));
} else {
//$NON-NLS-1$
interfaze.addImportedType(new FullyQualifiedJavaType("org.apache.ibatis.annotations.Result"));
//$NON-NLS-1$
interfaze.addImportedType(new FullyQualifiedJavaType("org.apache.ibatis.annotations.Results"));
}
}
use of org.mybatis.generator.api.dom.java.FullyQualifiedJavaType in project generator by mybatis.
the class AnnotatedSelectByExampleWithoutBLOBsMethodGenerator method addExtraImports.
@Override
public void addExtraImports(Interface interfaze) {
//$NON-NLS-1$
interfaze.addImportedType(new FullyQualifiedJavaType("org.apache.ibatis.annotations.SelectProvider"));
//$NON-NLS-1$
interfaze.addImportedType(new FullyQualifiedJavaType("org.apache.ibatis.type.JdbcType"));
if (introspectedTable.isConstructorBased()) {
//$NON-NLS-1$
interfaze.addImportedType(new FullyQualifiedJavaType("org.apache.ibatis.annotations.Arg"));
//$NON-NLS-1$
interfaze.addImportedType(new FullyQualifiedJavaType("org.apache.ibatis.annotations.ConstructorArgs"));
} else {
//$NON-NLS-1$
interfaze.addImportedType(new FullyQualifiedJavaType("org.apache.ibatis.annotations.Result"));
//$NON-NLS-1$
interfaze.addImportedType(new FullyQualifiedJavaType("org.apache.ibatis.annotations.Results"));
}
}
use of org.mybatis.generator.api.dom.java.FullyQualifiedJavaType in project generator by mybatis.
the class AnnotatedSelectByPrimaryKeyMethodGenerator method addAnnotationImports.
private void addAnnotationImports(Interface interfaze) {
//$NON-NLS-1$
interfaze.addImportedType(new FullyQualifiedJavaType("org.apache.ibatis.type.JdbcType"));
if (introspectedTable.isConstructorBased()) {
//$NON-NLS-1$
interfaze.addImportedType(new FullyQualifiedJavaType("org.apache.ibatis.annotations.Arg"));
//$NON-NLS-1$
interfaze.addImportedType(new FullyQualifiedJavaType("org.apache.ibatis.annotations.ConstructorArgs"));
} else {
//$NON-NLS-1$
interfaze.addImportedType(new FullyQualifiedJavaType("org.apache.ibatis.annotations.Result"));
//$NON-NLS-1$
interfaze.addImportedType(new FullyQualifiedJavaType("org.apache.ibatis.annotations.Results"));
}
}
use of org.mybatis.generator.api.dom.java.FullyQualifiedJavaType in project generator by mybatis.
the class AnnotatedUpdateByExampleWithBLOBsMethodGenerator method addMapperAnnotations.
@Override
public void addMapperAnnotations(Method method) {
FullyQualifiedJavaType fqjt = new FullyQualifiedJavaType(introspectedTable.getMyBatis3SqlProviderType());
StringBuilder sb = new StringBuilder();
//$NON-NLS-1$
sb.append("@UpdateProvider(type=");
sb.append(fqjt.getShortName());
//$NON-NLS-1$
sb.append(".class, method=\"");
sb.append(introspectedTable.getUpdateByExampleWithBLOBsStatementId());
//$NON-NLS-1$
sb.append("\")");
method.addAnnotation(sb.toString());
}
Aggregations