answer.addElement(resultElement);
}
}
private void addResultMapConstructorElements(XmlElement answer) {
XmlElement constructor = new XmlElement("constructor"); //$NON-NLS-1$
for (IntrospectedColumn introspectedColumn : introspectedTable.getPrimaryKeyColumns()) {
XmlElement resultElement = new XmlElement("idArg"); //$NON-NLS-1$
resultElement.addAttribute(new Attribute(
"column", MyBatis3FormattingUtilities.getRenamedColumnNameForResultMap(introspectedColumn))); //$NON-NLS-1$
resultElement.addAttribute(new Attribute("jdbcType", introspectedColumn.getJdbcTypeName())); //$NON-NLS-1$
resultElement.addAttribute(new Attribute("javaType", //$NON-NLS-1$
introspectedColumn.getFullyQualifiedJavaType().getFullyQualifiedName()));
if (stringHasValue(introspectedColumn.getTypeHandler())) {
resultElement.addAttribute(new Attribute("typeHandler", introspectedColumn.getTypeHandler())); //$NON-NLS-1$
}
constructor.addElement(resultElement);
}
for (IntrospectedColumn introspectedColumn : introspectedTable.getNonPrimaryKeyColumns()) {
XmlElement resultElement = new XmlElement("arg"); //$NON-NLS-1$
resultElement.addAttribute(new Attribute(
"column", MyBatis3FormattingUtilities.getRenamedColumnNameForResultMap(introspectedColumn))); //$NON-NLS-1$
resultElement.addAttribute(new Attribute("jdbcType", introspectedColumn.getJdbcTypeName())); //$NON-NLS-1$
if (introspectedColumn.getFullyQualifiedJavaType().isPrimitive()) {
// need to use the MyBatis type alias for a primitive byte
StringBuilder sb = new StringBuilder();
sb.append('_');
sb.append(introspectedColumn.getFullyQualifiedJavaType().getShortName());
resultElement.addAttribute(new Attribute("javaType", //$NON-NLS-1$
sb.toString()));
} else if ("byte[]".equals(introspectedColumn.getFullyQualifiedJavaType() //$NON-NLS-1$
.getFullyQualifiedName())) {
// need to use the MyBatis type alias for a primitive byte arry
resultElement.addAttribute(new Attribute("javaType", //$NON-NLS-1$
"_byte[]")); //$NON-NLS-1$
} else {
resultElement.addAttribute(new Attribute("javaType", //$NON-NLS-1$
introspectedColumn.getFullyQualifiedJavaType().getFullyQualifiedName()));
}
if (stringHasValue(introspectedColumn.getTypeHandler())) {
resultElement.addAttribute(new Attribute("typeHandler", introspectedColumn.getTypeHandler())); //$NON-NLS-1$
}
constructor.addElement(resultElement);
}