use of java.util.TreeSet in project generator by mybatis.
the class UpdateByPrimaryKeyWithBLOBsMethodGenerator method addInterfaceElements.
@Override
public void addInterfaceElements(Interface interfaze) {
Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
Method method = getMethodShell(importedTypes);
if (context.getPlugins().clientUpdateByPrimaryKeyWithBLOBsMethodGenerated(method, interfaze, introspectedTable)) {
interfaze.addImportedTypes(importedTypes);
interfaze.addMethod(method);
}
}
use of java.util.TreeSet in project generator by mybatis.
the class UpdateByPrimaryKeyWithoutBLOBsMethodGenerator method addInterfaceElements.
@Override
public void addInterfaceElements(Interface interfaze) {
Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
Method method = getMethodShell(importedTypes);
if (context.getPlugins().clientUpdateByPrimaryKeyWithoutBLOBsMethodGenerated(method, interfaze, introspectedTable)) {
interfaze.addImportedTypes(importedTypes);
interfaze.addMethod(method);
}
}
use of java.util.TreeSet in project generator by mybatis.
the class OutputUtilities method calculateImports.
/**
* returns a unique set of "import xxx;" Strings for the set of types.
*
* @param importedTypes
* the imported types
* @return the sets the
*/
public static Set<String> calculateImports(Set<FullyQualifiedJavaType> importedTypes) {
StringBuilder sb = new StringBuilder();
Set<String> importStrings = new TreeSet<String>();
for (FullyQualifiedJavaType fqjt : importedTypes) {
for (String importString : fqjt.getImportList()) {
sb.setLength(0);
//$NON-NLS-1$
sb.append("import ");
sb.append(importString);
sb.append(';');
importStrings.add(sb.toString());
}
}
return importStrings;
}
use of java.util.TreeSet in project generator by mybatis.
the class SelectByExampleWithoutBLOBsMethodGenerator method addImplementationElements.
@Override
public void addImplementationElements(TopLevelClass topLevelClass) {
Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
Method method = getMethodShell(importedTypes);
if (generateForJava5) {
method.addSuppressTypeWarningsAnnotation();
}
StringBuilder sb = new StringBuilder();
sb.append(method.getReturnType().getShortName());
//$NON-NLS-1$
sb.append(" list = ");
sb.append(daoTemplate.getQueryForListMethod(introspectedTable.getIbatis2SqlMapNamespace(), introspectedTable.getSelectByExampleStatementId(), //$NON-NLS-1$
"example"));
method.addBodyLine(sb.toString());
//$NON-NLS-1$
method.addBodyLine("return list;");
if (context.getPlugins().clientSelectByExampleWithoutBLOBsMethodGenerated(method, topLevelClass, introspectedTable)) {
topLevelClass.addImportedTypes(importedTypes);
topLevelClass.addMethod(method);
}
}
use of java.util.TreeSet in project generator by mybatis.
the class UpdateByExampleSelectiveMethodGenerator method addImplementationElements.
@Override
public void addImplementationElements(TopLevelClass topLevelClass) {
Set<FullyQualifiedJavaType> importedTypes = new TreeSet<FullyQualifiedJavaType>();
Method method = getMethodShell(importedTypes);
method.addBodyLine(//$NON-NLS-1$
"UpdateByExampleParms parms = new UpdateByExampleParms(record, example);");
StringBuilder sb = new StringBuilder();
//$NON-NLS-1$
sb.append("int rows = ");
sb.append(daoTemplate.getUpdateMethod(introspectedTable.getIbatis2SqlMapNamespace(), introspectedTable.getUpdateByExampleSelectiveStatementId(), //$NON-NLS-1$
"parms"));
method.addBodyLine(sb.toString());
//$NON-NLS-1$
method.addBodyLine("return rows;");
if (context.getPlugins().clientUpdateByExampleSelectiveMethodGenerated(method, topLevelClass, introspectedTable)) {
topLevelClass.addImportedTypes(importedTypes);
topLevelClass.addMethod(method);
}
}
Aggregations