*
* @param classInfo the XML Schema element declaration
* @return the ClassMapping representing the ClassInfo
*/
public ClassMapping createMapping(final ClassInfo classInfo) {
JClass jClass = classInfo.getJClass();
String className = jClass.getName();
ClassMapping classMapping = new ClassMapping();
classMapping.setName(className);
//-- Set namespace prefix
MapTo mapTo = new MapTo();
classMapping.setMapTo(mapTo);
XMLInfoNature xmlNature = new XMLInfoNature(classInfo);
String nsPrefix = xmlNature.getNamespacePrefix();
if ((nsPrefix != null) && (nsPrefix.length() > 0)) {
mapTo.setNsPrefix(nsPrefix);
}
//-- Set namespace URI
String nsURI = xmlNature.getNamespaceURI();
if ((nsURI != null) && (nsURI.length() > 0)) {
mapTo.setNsUri(nsURI);
}
//-- set XML Name
mapTo.setXml(xmlNature.getNodeName());
//-- set Element Definition flag
mapTo.setElementDefinition(xmlNature.isElementDefinition());
//-- set grouping compositor
if (xmlNature.isChoice()) {
// TODO need a way to specify choice in Mapping file
}
boolean isAbstract = classInfo.isAbstract();
if (!isAbstract) {
isAbstract = jClass.getModifiers().isAbstract();
}
classInfo.setAbstract(isAbstract);
//-- To prevent compiler warnings...make sure
//-- we don't declare temp variables if field count is 0;