Ejemplo n.º 1
0
 protected Template readExternal(Element element, final String templateName) {
   TemplateImpl template =
       new TemplateImpl(
           element.getAttributeValue("name"), element.getAttributeValue("value"), templateName);
   template.setDescription(element.getAttributeValue("description"));
   template.setToReformat(Boolean.valueOf(element.getAttributeValue("toReformat")));
   template.setToShortenLongNames(Boolean.valueOf(element.getAttributeValue("toShortenFQNames")));
   TemplateContext context = template.getTemplateContext();
   for (Object o : element.getChildren("variable")) {
     Element e = (Element) o;
     template.addVariable(
         e.getAttributeValue("name"),
         e.getAttributeValue("expression"),
         e.getAttributeValue("defaultValue"),
         Boolean.valueOf(e.getAttributeValue("alwaysStopAt")));
   }
   Element contextElement = element.getChild("context");
   if (contextElement != null) {
     try {
       context.readExternal(contextElement);
     } catch (InvalidDataException e) {
       e.printStackTrace();
     }
   }
   return template;
 }