Search in sources :

Example 1 with ElementRef

use of com.webcohesion.enunciate.modules.jaxb.model.ElementRef in project enunciate by stoicflame.

the class PHPXMLClientModule method usesUnmappableElements.

protected boolean usesUnmappableElements() {
    boolean usesUnmappableElements = false;
    if (this.jaxbModule != null && this.jaxbModule.getJaxbContext() != null && !this.jaxbModule.getJaxbContext().getSchemas().isEmpty()) {
        for (SchemaInfo schemaInfo : this.jaxbModule.getJaxbContext().getSchemas().values()) {
            for (TypeDefinition complexType : schemaInfo.getTypeDefinitions()) {
                if (!Character.isUpperCase(complexType.getClientSimpleName().charAt(0))) {
                    warn("%s: PHP requires your class name to be upper-case. Please rename the class or apply the @org.codehaus.enunciate.ClientName annotation to the class.", positionOf(complexType));
                    usesUnmappableElements = true;
                }
                for (Element element : complexType.getElements()) {
                    if (element instanceof ElementRef && element.isElementRefs()) {
                        info("%s: The PHP client library doesn't fully support the @XmlElementRefs annotation. The items in the collection will be read-only and will only be available to PHP clients in the form of a Hash. Consider redesigning using a collection of a single type.", positionOf(element));
                    } else if (element.getAnnotation(XmlElements.class) != null) {
                        info("%s: The PHP client library doesn't fully support the @XmlElements annotation. The items in the collection will be read-only and will only be available to PHP clients in the form of a Hash. Consider redesigning using a collection of a single type.", positionOf(element));
                    }
                }
            }
        }
    }
    return usesUnmappableElements;
}
Also used : ElementRef(com.webcohesion.enunciate.modules.jaxb.model.ElementRef) TypeElement(javax.lang.model.element.TypeElement) DecoratedTypeElement(com.webcohesion.enunciate.javac.decorations.element.DecoratedTypeElement) Element(com.webcohesion.enunciate.modules.jaxb.model.Element) SchemaInfo(com.webcohesion.enunciate.modules.jaxb.model.SchemaInfo) TypeDefinition(com.webcohesion.enunciate.modules.jaxb.model.TypeDefinition)

Aggregations

DecoratedTypeElement (com.webcohesion.enunciate.javac.decorations.element.DecoratedTypeElement)1 Element (com.webcohesion.enunciate.modules.jaxb.model.Element)1 ElementRef (com.webcohesion.enunciate.modules.jaxb.model.ElementRef)1 SchemaInfo (com.webcohesion.enunciate.modules.jaxb.model.SchemaInfo)1 TypeDefinition (com.webcohesion.enunciate.modules.jaxb.model.TypeDefinition)1 TypeElement (javax.lang.model.element.TypeElement)1