@Override public String convertUnwrappedObject(Object unwrapped) throws TemplateModelException { if (unwrapped instanceof Accessor) { return convert((Accessor) unwrapped); } else if (unwrapped instanceof ImplicitChildElement) { return convert((ImplicitChildElement) unwrapped); } else { return super.convertUnwrappedObject(unwrapped); } }
/** * Get the bean name for a specified string. * * @param conversion The conversion to use. * @param preconvert The pre-converted fqn. * @return The converted fqn. */ protected String getBeanName(ClientClassnameForMethod conversion, String preconvert) { String pckg = conversion.convert(preconvert.substring(0, preconvert.lastIndexOf('.'))); String simpleName = preconvert.substring(preconvert.lastIndexOf('.') + 1); return pckg + "." + simpleName; }
/** * Get the bean name for a specified string. * * @param conversion The conversion to use. * @param preconvert The pre-converted fqn. * @return The converted fqn. */ protected String getBeanName(ClientClassnameForMethod conversion, String preconvert) { String pckg = conversion.convert(preconvert.substring(0, preconvert.lastIndexOf('.'))); String simpleName = preconvert.substring(preconvert.lastIndexOf('.') + 1); return pckg + "." + simpleName; }
@Override public String convert(Accessor accessor) throws TemplateModelException { if (accessor.isXmlIDREF()) { return "String"; } return super.convert(accessor); }
@Override public String convert(Accessor accessor) throws TemplateModelException { if (accessor.isXmlIDREF()) { return "string"; } return super.convert(accessor); }
@Override public String convert(Accessor accessor) throws TemplateModelException { if (accessor.isXmlIDREF()) { return "string";//C# doesn't support strict object reference resolution via IDREF. The best we can do is (de)serialize the ID. } return super.convert(accessor); }
@Override public String convert(Accessor accessor) throws TemplateModelException { if (accessor.isXmlIDREF()) { return "String"; } return super.convert(accessor); }
@Override public String convert(TypeDeclaration declaration) throws TemplateModelException { if (classConversions.containsKey(declaration.getQualifiedName())) { return classConversions.get(declaration.getQualifiedName()); } return super.convert(declaration); } }
@Override public String convert(TypeDeclaration declaration) throws TemplateModelException { String fqn = declaration.getQualifiedName(); if (classConversions.containsKey(fqn)) { return classConversions.get(fqn); } else if (isCollection(declaration)) { return "xmlNode"; } return super.convert(declaration); }
@Override public String convert(TypeDeclaration declaration) { if (classConversions.containsKey(declaration.getQualifiedName())) { return classConversions.get(declaration.getQualifiedName()); } return declaration instanceof EnumDeclaration ? String.class.getName() : super.convert(declaration); } }
@Override public String convert(TypeDeclaration declaration) throws TemplateModelException { String fqn = declaration.getQualifiedName(); if (classConversions.containsKey(fqn)) { return classConversions.get(fqn); } else if (isCollection(declaration)) { return "global::System.Collections.ArrayList"; } return super.convert(declaration); }
@Override public String convert(Accessor accessor) throws TemplateModelException { if (accessor.isXmlIDREF()) { return "xmlChar"; } else if (accessor.isXmlList()) { return "xmlChar"; } return super.convert(accessor); }
@Override public String convert(TypeDeclaration declaration) throws TemplateModelException { if (classConversions.containsKey(declaration.getQualifiedName())) { return classConversions.get(declaration.getQualifiedName()); } else if (isCollection(declaration)) { return "com.google.gwt.core.client.JsArray"; } return super.convert(declaration); }
@Override public String convert(TypeDeclaration declaration) throws TemplateModelException { String fqn = declaration.getQualifiedName(); if (classConversions.containsKey(fqn)) { return classConversions.get(fqn); } else if (declaration instanceof EnumDeclaration) { return "String"; } else if (isCollection(declaration) || isMap(declaration)) { return "Array"; } return super.convert(declaration); }
/** * Adds explicit elements for the specified root element. * * @param rootElement The root element. * @param conversion The conversion to use. */ protected void addExplicitAnnotations(RootElementDeclaration rootElement, ClientClassnameForMethod conversion) { String classname = conversion.convert(rootElement); this.generatedAnnotations.class2XmlRootElement.put(classname, new XmlRootElementAnnotation(rootElement.getNamespace(), rootElement.getName())); }
/** * Adds explicit elements for the specified root element. * * @param rootElement The root element. * @param conversion The conversion to use. */ protected void addExplicitAnnotations(RootElementDeclaration rootElement, ClientClassnameForMethod conversion) throws TemplateModelException { String classname = conversion.convert(rootElement); this.generatedAnnotations.class2XmlRootElement.put(classname, new XmlRootElementAnnotation(rootElement.getNamespace(), rootElement.getName())); }
@Override public String convert(Accessor accessor) throws TemplateModelException { if (accessor.isCollectionType() && accessor instanceof Element) { Element element = (Element) accessor; //@XmlElementRefs and @XmlElements can't if (element instanceof ElementRef && ((ElementRef) element).isElementRefs()) { return "com.google.gwt.core.client.JsArray"; } else if (element.getAnnotation(XmlElements.class) != null) { return "com.google.gwt.core.client.JsArray"; } } return super.convert(accessor); }
@Override public String convert(Accessor accessor) throws TemplateModelException { if (!accessor.isXmlList() && !accessor.isAdapted() && accessor.getBareAccessorType() instanceof InterfaceType) { if (accessor.isCollectionType()) { return "java.util.List<Object>"; } else { return "Object"; } } return super.convert(accessor); }
@Override public String convert(Accessor accessor) throws TemplateModelException { TypeMirror accessorType = accessor.getAccessorType(); if (accessor.isAdapted()) { accessorType = accessor.getAdapterType().getAdaptingType(accessor.getAccessorType()); } return convert(accessorType); }
@Override public String convert(ImplicitChildElement childElement) throws TemplateModelException { TypeMirror elementType = childElement.getType(); if ((childElement instanceof Adaptable) && (((Adaptable) childElement).isAdapted())) { elementType = (((Adaptable) childElement).getAdapterType().getAdaptingType(childElement.getType())); } return convert(elementType); }