Ejemplo n.º 1
0
 public void visitClassType(ClassType classType) {
   MapType mapType = MapTypeUtil.findMapType(classType);
   if (mapType != null) {
     setMapXmlType(mapType);
   } else {
     XmlType xmlType = null;
     EnunciateFreemarkerModel model = (EnunciateFreemarkerModel) FreemarkerModel.get();
     ClassDeclaration declaration = classType.getDeclaration();
     if (declaration != null) {
       XmlType knownType = model.getKnownType(declaration);
       if (knownType != null) {
         xmlType = knownType;
       } else {
         // type not known, not specified.  Last chance: look for the type definition.
         TypeDefinition typeDefinition = model.findTypeDefinition(declaration);
         if (typeDefinition != null) {
           xmlType = new XmlClassType(typeDefinition);
         }
       }
     }
     this.xmlType = xmlType;
     if (xmlType == null) {
       this.errorMessage =
           "Unknown xml type for class: "
               + classType
               + ".  If this is a class that is already compiled, you either need to specify an 'api-import' "
               + "element in the configuration file, or your class needs to be explicitly exported. See the FAQ "
               + "( http://tinyurl.com/cte3oq ) for details.";
     }
   }
 }
Ejemplo n.º 2
0
 public void visitDeclaredType(DeclaredType declaredType) {
   MapType mapType = MapTypeUtil.findMapType(declaredType);
   if (mapType != null) {
     setMapXmlType(mapType);
   } else {
     this.xmlType = null;
     this.errorMessage = "Unknown xml type: " + declaredType;
   }
 }
Ejemplo n.º 3
0
 public void visitInterfaceType(InterfaceType interfaceType) {
   AdapterType adapterType = AdapterUtil.findAdapterType(interfaceType.getDeclaration());
   if (adapterType != null) {
     adapterType.getAdaptingType().accept(this);
   } else {
     MapType mapType = MapTypeUtil.findMapType(interfaceType);
     if (mapType != null) {
       setMapXmlType(mapType);
     } else {
       this.xmlType = null;
       this.errorMessage = "An interface type cannot be an xml type.";
     }
   }
 }