use of org.mybatis.generator.api.dom.java.FullyQualifiedJavaType in project generator by mybatis.
the class FullyQualifiedJavaTypeTest method testComplexArray.
@Test
public void testComplexArray() {
FullyQualifiedJavaType fqjt = new FullyQualifiedJavaType("java.util.List<String>[]");
assertFalse(fqjt.isPrimitive());
assertTrue(fqjt.isArray());
}
use of org.mybatis.generator.api.dom.java.FullyQualifiedJavaType in project generator by mybatis.
the class FullyQualifiedJavaTypeTest method testSimpleType3.
@Test
public void testSimpleType3() {
FullyQualifiedJavaType fqjt = //$NON-NLS-1$
new FullyQualifiedJavaType("int");
assertFalse(fqjt.isExplicitlyImported());
//$NON-NLS-1$
assertEquals("int", fqjt.getShortName());
//$NON-NLS-1$
assertEquals("int", fqjt.getFullyQualifiedName());
//$NON-NLS-1$
assertEquals("", fqjt.getPackageName());
assertEquals(0, fqjt.getImportList().size());
}
use of org.mybatis.generator.api.dom.java.FullyQualifiedJavaType in project generator by mybatis.
the class FullyQualifiedJavaTypeTest method testGenericType3.
@Test
public void testGenericType3() {
//$NON-NLS-1$
FullyQualifiedJavaType listOfStrings = new FullyQualifiedJavaType("java.util.List");
//$NON-NLS-1$
listOfStrings.addTypeArgument(new FullyQualifiedJavaType("java.lang.String"));
FullyQualifiedJavaType fqjt = //$NON-NLS-1$
new FullyQualifiedJavaType("java.util.Map");
//$NON-NLS-1$
fqjt.addTypeArgument(new FullyQualifiedJavaType("java.lang.String"));
fqjt.addTypeArgument(listOfStrings);
assertTrue(fqjt.isExplicitlyImported());
//$NON-NLS-1$
assertEquals("Map<String, List<String>>", fqjt.getShortName());
//$NON-NLS-1$
assertEquals("java.util.Map<java.lang.String, java.util.List<java.lang.String>>", fqjt.getFullyQualifiedName());
//$NON-NLS-1$
assertEquals("java.util", fqjt.getPackageName());
assertEquals(2, fqjt.getImportList().size());
//$NON-NLS-1$
assertEquals("java.util.Map", fqjt.getFullyQualifiedNameWithoutTypeParameters());
}
use of org.mybatis.generator.api.dom.java.FullyQualifiedJavaType in project generator by mybatis.
the class JavaMapperGenerator method getCompilationUnits.
@Override
public List<CompilationUnit> getCompilationUnits() {
progressCallback.startTask(getString(//$NON-NLS-1$
"Progress.17", introspectedTable.getFullyQualifiedTable().toString()));
CommentGenerator commentGenerator = context.getCommentGenerator();
FullyQualifiedJavaType type = new FullyQualifiedJavaType(introspectedTable.getMyBatis3JavaMapperType());
Interface interfaze = new Interface(type);
interfaze.setVisibility(JavaVisibility.PUBLIC);
commentGenerator.addJavaFileComment(interfaze);
String rootInterface = introspectedTable.getTableConfigurationProperty(PropertyRegistry.ANY_ROOT_INTERFACE);
if (!stringHasValue(rootInterface)) {
rootInterface = context.getJavaClientGeneratorConfiguration().getProperty(PropertyRegistry.ANY_ROOT_INTERFACE);
}
if (stringHasValue(rootInterface)) {
FullyQualifiedJavaType fqjt = new FullyQualifiedJavaType(rootInterface);
interfaze.addSuperInterface(fqjt);
interfaze.addImportedType(fqjt);
}
addCountByExampleMethod(interfaze);
addDeleteByExampleMethod(interfaze);
addDeleteByPrimaryKeyMethod(interfaze);
addInsertMethod(interfaze);
addInsertSelectiveMethod(interfaze);
addSelectByExampleWithBLOBsMethod(interfaze);
addSelectByExampleWithoutBLOBsMethod(interfaze);
addSelectByPrimaryKeyMethod(interfaze);
addUpdateByExampleSelectiveMethod(interfaze);
addUpdateByExampleWithBLOBsMethod(interfaze);
addUpdateByExampleWithoutBLOBsMethod(interfaze);
addUpdateByPrimaryKeySelectiveMethod(interfaze);
addUpdateByPrimaryKeyWithBLOBsMethod(interfaze);
addUpdateByPrimaryKeyWithoutBLOBsMethod(interfaze);
List<CompilationUnit> answer = new ArrayList<CompilationUnit>();
if (context.getPlugins().clientGenerated(interfaze, null, introspectedTable)) {
answer.add(interfaze);
}
List<CompilationUnit> extraCompilationUnits = getExtraCompilationUnits();
if (extraCompilationUnits != null) {
answer.addAll(extraCompilationUnits);
}
return answer;
}
use of org.mybatis.generator.api.dom.java.FullyQualifiedJavaType in project generator by mybatis.
the class UpdateByPrimaryKeySelectiveMethodGenerator method getMethodShell.
private Method getMethodShell(Set<FullyQualifiedJavaType> importedTypes) {
FullyQualifiedJavaType parameterType;
if (introspectedTable.getRules().generateRecordWithBLOBsClass()) {
parameterType = new FullyQualifiedJavaType(introspectedTable.getRecordWithBLOBsType());
} else {
parameterType = new FullyQualifiedJavaType(introspectedTable.getBaseRecordType());
}
importedTypes.add(parameterType);
Method method = new Method();
method.setVisibility(JavaVisibility.PUBLIC);
method.setReturnType(FullyQualifiedJavaType.getIntInstance());
method.setName(getDAOMethodNameCalculator().getUpdateByPrimaryKeySelectiveMethodName(introspectedTable));
//$NON-NLS-1$
method.addParameter(new Parameter(parameterType, "record"));
for (FullyQualifiedJavaType fqjt : daoTemplate.getCheckedExceptions()) {
method.addException(fqjt);
importedTypes.add(fqjt);
}
context.getCommentGenerator().addGeneralMethodComment(method, introspectedTable);
return method;
}
Aggregations