@Override
 public void handleSqlTableType(String tableTypeName, String targetTypeName) {
   // trim-off dotted-prefix, toLowerCase
   String tableTypeNameAlias = trimDotPrefix(tableTypeName).toLowerCase();
   String userType = nct.generateSchemaAlias(tableTypeNameAlias);
   XMLDescriptor xdesc = descriptorMap.get(tableTypeNameAlias);
   if (xdesc == null) {
     xdesc = new XMLDescriptor();
     xdesc.setAlias(tableTypeNameAlias);
     xdesc.setJavaClassName(
         packageName.toLowerCase() + "." + tableTypeNameAlias + COLLECTION_WRAPPER_SUFFIX);
     xdesc.getQueryManager();
     XMLSchemaURLReference schemaReference = new XMLSchemaURLReference();
     schemaReference.setSchemaContext("/" + userType);
     schemaReference.setType(XMLSchemaReference.COMPLEX_TYPE);
     xdesc.setSchemaReference(schemaReference);
     NamespaceResolver nr = new NamespaceResolver();
     nr.setDefaultNamespaceURI(targetNamespace);
     xdesc.setNamespaceResolver(nr);
     descriptorMap.put(tableTypeNameAlias, xdesc);
   }
   // before we push the new SqlArrayTypeHelper, check stac to see if we are part
   // of nested chain of object types
   if (!stac.isEmpty()) {
     ListenerHelper listenerHelper = stac.peek();
     if (listenerHelper.isReturnArg()) {
       xdesc.setDefaultRootElement(userType);
     }
   }
   stac.push(new SqlArrayTypeHelper(tableTypeNameAlias, targetTypeName));
 }
 @Override
 public void handleObjectType(String objectTypeName, String targetTypeName, int numAttributes) {
   // JDBC Advanced type?
   if (numAttributes > 0) {
     // trim-off dotted-prefix, toLowerCase
     String objectTypeNameAlias = trimDotPrefix(objectTypeName).toLowerCase();
     XMLDescriptor xdesc = descriptorMap.get(objectTypeNameAlias);
     String userType = nct.generateSchemaAlias(objectTypeNameAlias);
     if (xdesc == null) {
       xdesc = new XMLDescriptor();
       xdesc.setAlias(objectTypeNameAlias);
       xdesc.setJavaClassName(packageName.toLowerCase() + "." + objectTypeNameAlias);
       xdesc.getQueryManager();
       XMLSchemaURLReference schemaReference = new XMLSchemaURLReference();
       schemaReference.setSchemaContext("/" + userType);
       schemaReference.setType(XMLSchemaReference.COMPLEX_TYPE);
       xdesc.setSchemaReference(schemaReference);
       NamespaceResolver nr = new NamespaceResolver();
       nr.setDefaultNamespaceURI(targetNamespace);
       xdesc.setNamespaceResolver(nr);
       descriptorMap.put(objectTypeNameAlias, xdesc);
     }
     // before we push the new ObjectTypeHelper, check stac to see if we are part
     // of nested chain of object types
     if (!stac.isEmpty()) {
       ListenerHelper listenerHelper = stac.peek();
       if (listenerHelper.isAttribute()) {
         AttributeFieldHelper fieldHelper = (AttributeFieldHelper) stac.pop();
         fieldHelper.setSqlTypeName(objectTypeNameAlias);
         String fieldName = fieldHelper.attributeFieldName();
         String attributeName = fieldName.toLowerCase();
         ListenerHelper listenerHelper2 = stac.peek();
         if (listenerHelper2.isObject()) {
           ObjectTypeHelper objectTypeHelper2 = (ObjectTypeHelper) listenerHelper2;
           String objectTypeNameAlias2 = objectTypeHelper2.objectTypename();
           XMLDescriptor xdesc2 = descriptorMap.get(objectTypeNameAlias2);
           if (xdesc2 != null) {
             DatabaseMapping dm = xdesc2.getMappingForAttributeName(attributeName);
             if (dm == null) {
               XMLCompositeObjectMapping compMapping = new XMLCompositeObjectMapping();
               compMapping.setAttributeName(attributeName);
               compMapping.setReferenceClassName(xdesc.getJavaClassName());
               compMapping.setXPath(attributeName);
               XMLField xField = (XMLField) compMapping.getField();
               xField.setRequired(true);
               xdesc2.addMapping(compMapping);
             }
             // last attribute, pop ObjectTypeHelper off stack
             int numAttributes2 = objectTypeHelper2.decrNumAttributes();
             if (numAttributes2 == 0) {
               stac.pop();
             }
           }
         }
       } else if (listenerHelper.isArray()) {
         SqlArrayTypeHelper sqlArrayTypeHelper = (SqlArrayTypeHelper) stac.pop();
         String sqlArrayTypeAlias = sqlArrayTypeHelper.arrayTypename();
         XMLDescriptor xdesc2 = descriptorMap.get(sqlArrayTypeAlias);
         if (xdesc2 != null) {
           boolean itemsMappingFound =
               xdesc2.getMappingForAttributeName(ITEMS_MAPPING_ATTRIBUTE_NAME) == null
                   ? false
                   : true;
           if (!itemsMappingFound) {
             XMLCompositeCollectionMapping itemsMapping = new XMLCompositeCollectionMapping();
             itemsMapping.setAttributeName(ITEMS_MAPPING_ATTRIBUTE_NAME);
             itemsMapping.setXPath(ITEM_MAPPING_NAME);
             itemsMapping.useCollectionClassName("java.util.ArrayList");
             itemsMapping.setReferenceClassName(xdesc.getJavaClassName());
             xdesc2.addMapping(itemsMapping);
           }
         }
       } else if (listenerHelper.isReturnArg()) {
         // ReturnArgHelper returnArgHelper = (ReturnArgHelper)stac.pop();
         stac.pop();
         xdesc.setDefaultRootElement(userType);
       }
     }
     stac.push(new ObjectTypeHelper(objectTypeNameAlias, targetTypeName, numAttributes));
   }
 }