Esempio n. 1
0
 /**
  * Return the class for a given qualified XML Schema type. If the class is a primitive the
  * corresponding wrapper class is returned
  *
  * @param qname The qualified name of the XML Schema type to use as a key in the lookup
  * @return The class associated with the specified schema type, if no corresponding match found
  *     returns null
  */
 public Class getJavaClass(QName qname) {
   if (userXMLTypes != null) {
     if (userXMLTypes.containsKey(qname)) {
       return (Class) userXMLTypes.get(qname);
     }
   }
   Class javaClass =
       (Class) XMLConversionManager.getDefaultXMLManager().getDefaultXMLTypes().get(qname);
   return XMLConversionManager.getObjectClass(javaClass);
 }
Esempio n. 2
0
 /** INTERNAL: */
 public Object convertValueBasedOnSchemaType(
     Object value, XMLConversionManager xmlConversionManager) {
   Object convertedValue = value;
   for (int i = 0; i < schemaTypes.size(); i++) {
     QName nextQName = (QName) schemaTypes.get(i);
     try {
       if (nextQName != null) {
         Class javaClass = getType();
         javaClass = getJavaClass(nextQName);
         convertedValue = xmlConversionManager.convertObject(value, javaClass, nextQName);
         break;
       }
     } catch (ConversionException ce) {
       if (i == (schemaTypes.size() - 1)) {
         throw ce;
       }
     }
   }
   return convertedValue;
 }