public Object exec(List list) throws TemplateModelException { if (list.size() < 1) { throw new TemplateModelException("The accessorOverridesAnother method must have the accessor as a parameter."); } TemplateModel from = (TemplateModel) list.get(0); Object unwrapped = BeansWrapper.getDefaultInstance().unwrap(from); if (!(unwrapped instanceof Accessor)) { throw new TemplateModelException("The accessorOverridesAnother method must have the accessor as a parameter."); } return overridesAnother((Accessor) unwrapped); }
model.put("overlaySimpleNameFor", new SimpleNameWithParamsMethod(overlayClassnameFor)); model.put("gwtSubcontext", getGwtSubcontext()); model.put("accessorOverridesAnother", new AccessorOverridesAnotherMethod());
model.put("prefix", new PrefixMethod()); model.put("xmlFunctionIdentifier", new XmlFunctionIdentifierMethod()); model.put("accessorOverridesAnother", new AccessorOverridesAnotherMethod());
model.put("amfComponentTypeFor", new ComponentTypeForMethod(packages)); model.put("forEachAS3Import", new ForEachAS3ImportTransform(null, as3ClassnameFor)); model.put("accessorOverridesAnother", new AccessorOverridesAnotherMethod()); model.put("as3Aliases", as3Aliases);
protected Iterator<Accessor> getLoop(TemplateModel model) throws TemplateException { TypeDefinition typeDef = getTypeDefinition(); if (typeDef == null) { throw new TemplateException("A type definition must be supplied."); } List<Accessor> accessors = new ArrayList<Accessor>(); if (attributes) { aggregateAttributes(accessors, typeDef); } if (value) { Value value = findValue(typeDef); if (value != null && !OVERRIDE_CHECK.overridesAnother(value)) { accessors.add(value); } } if (elements) { aggregateElements(accessors, typeDef); } return accessors.iterator(); }
@Override public void doFreemarkerGenerate() throws IOException, TemplateException { File genDir = getGenerateDir(); if (!enunciate.isUpToDateWithSources(genDir)) { EnunciateFreemarkerModel model = getModel(); ClientPackageForMethod namespaceFor = new ClientPackageForMethod(this.packageToNamespaceConversions); namespaceFor.setUseClientNameConversions(true); model.put("namespaceFor", namespaceFor); model.put("findRootElement", new FindRootElementMethod()); model.put("requestDocumentQName", new RequestDocumentQNameMethod()); model.put("responseDocumentQName", new ResponseDocumentQNameMethod()); ClientClassnameForMethod classnameFor = new ClientClassnameForMethod(this.packageToNamespaceConversions); classnameFor.setUseClientNameConversions(true); model.put("classnameFor", classnameFor); model.put("listsAsArraysClassnameFor", new ListsAsArraysClientClassnameForMethod(this.packageToNamespaceConversions)); model.put("simpleNameFor", new SimpleNameWithParamsMethod(classnameFor)); model.put("csFileName", getSourceFileName()); model.put("accessorOverridesAnother", new AccessorOverridesAnotherMethod()); debug("Generating the C# client classes..."); URL apiTemplate = isSingleFilePerClass() ? getTemplateURL("api-multiple-files.fmt") : getTemplateURL("api.fmt"); processTemplate(apiTemplate, model); } else { info("Skipping C# code generation because everything appears up-to-date."); } }
private void aggregateAttributes(List<Accessor> accessors, TypeDefinition typeDef) { if (!typeDef.isBaseObject()) { XmlType baseType = typeDef.getBaseType(); if (baseType instanceof XmlClassType) { aggregateAttributes(accessors, ((XmlClassType)baseType).getTypeDefinition()); } } for (Attribute attribute : typeDef.getAttributes()) { if (FacetFilter.accept(attribute) && !OVERRIDE_CHECK.overridesAnother(attribute)) { accessors.add(attribute); } } }
private void aggregateElements(List<Accessor> accessors, TypeDefinition typeDef) { if (!typeDef.isBaseObject()) { XmlType baseType = typeDef.getBaseType(); if (baseType instanceof XmlClassType) { aggregateElements(accessors, ((XmlClassType)baseType).getTypeDefinition()); } } for (Element element : typeDef.getElements()) { if (FacetFilter.accept(element) && !OVERRIDE_CHECK.overridesAnother(element)) { accessors.add(element); } } }