Package javax.xml.bind.annotation

Examples of javax.xml.bind.annotation.XmlElementDecl


            // looking at members will only add more errors, so just abort now
            return;
        }

        for( M m : nav.getDeclaredMethods(registryClass) ) {
            XmlElementDecl em = builder.reader.getMethodAnnotation(
                XmlElementDecl.class, m, this );

            if(em==null) {
                if(nav.getMethodName(m).startsWith("create")) {
                    // this is a factory method. visit this class
View Full Code Here


            // looking at members will only add more errors, so just abort now
            return;
        }

        for( M m : nav.getDeclaredMethods(registryClass) ) {
            XmlElementDecl em = builder.reader.getMethodAnnotation(
                XmlElementDecl.class, m, this );

            if(em==null) {
                if(nav.getMethodName(m).startsWith("create")) {
                    // this is a factory method. visit this class
View Full Code Here

        return cachedContextAndSchemas;
    }
   
    private boolean checkObjectFactoryNamespaces(Class<?> clz) {
        for (Method meth : clz.getMethods()) {
            XmlElementDecl decl = meth.getAnnotation(XmlElementDecl.class);
            if (decl != null
                && XmlElementDecl.GLOBAL.class.equals(decl.scope())
                && StringUtils.isEmpty(decl.namespace())) {
                return true;
            }
        }

        return false;
View Full Code Here

    private static QName getTypeXMLQName(Class<?> type, Class<?> objectFactory) throws SwitchYardException {
        Method[] factoryMethods = objectFactory.getDeclaredMethods();

        for (Method factoryMethod : factoryMethods) {
            XmlElementDecl xmlElementDecl = factoryMethod.getAnnotation(XmlElementDecl.class);
            if (xmlElementDecl != null) {
                Class<?>[] factoryParams = factoryMethod.getParameterTypes();

                if (factoryParams.length == 1) {
                    QName qName = new QName(xmlElementDecl.namespace(), xmlElementDecl.name());
                    Class<?> factoryParam = factoryParams[0];

                    if (factoryParam == type) {
                        // This is the factory method for the specified type...
                        return qName;
View Full Code Here

        Method[] factoryMethods = objectFactory.getDeclaredMethods();

        messageBuilder.append(TransformMessages.MESSAGES.noJAXBElementFactoryDefined(type.getName(), objectFactory.getName()));

        for (Method factoryMethod : factoryMethods) {
            XmlElementDecl xmlElementDecl = factoryMethod.getAnnotation(XmlElementDecl.class);
            if (xmlElementDecl != null) {
                Class<?>[] factoryParams = factoryMethod.getParameterTypes();

                if (factoryParams.length == 1) {
                    QName qName = new QName(xmlElementDecl.namespace(), xmlElementDecl.name());
                    Class<?> factoryParam = factoryParams[0];

                    messageBuilder.append("\n\t\t- Message QName: '" + qName.toString() + "'. Java Type: " + factoryParam.getName());
                }
            }
View Full Code Here

                    defaultValue = xmlEltDecl.getDefaultValue();
                }
            } else {
                // there was no xml-element-decl for this method in XML,
                // so use the annotation
                XmlElementDecl elementDecl = (XmlElementDecl) helper.getAnnotation(next, XmlElementDecl.class);
                url = elementDecl.namespace();
                localName = elementDecl.name();
                scopeClass = elementDecl.scope();
                if (!elementDecl.substitutionHeadName().equals(EMPTY_STRING)) {
                    String subHeadLocal = elementDecl.substitutionHeadName();
                    String subHeadNamespace = elementDecl.substitutionHeadNamespace();
                    if (subHeadNamespace.equals(XMLProcessor.DEFAULT)) {
                        subHeadNamespace = packageInfo.getNamespace();
                    }

                    substitutionHead = new QName(subHeadNamespace, subHeadLocal);
                }
                if (!(elementDecl.defaultValue().length() == 1 && elementDecl.defaultValue().startsWith(ELEMENT_DECL_DEFAULT))) {
                    defaultValue = elementDecl.defaultValue();
                }
            }
           
            if (XMLProcessor.DEFAULT.equals(url)) {
                url = packageInfo.getNamespace();
View Full Code Here

            // looking at members will only add more errors, so just abort now
            return;
        }

        for( M m : nav.getDeclaredMethods(registryClass) ) {
            XmlElementDecl em = builder.reader.getMethodAnnotation(
                XmlElementDecl.class, m, this );

            if(em==null) {
                if(nav.getMethodName(m).startsWith("create")) {
                    // this is a factory method. visit this class
View Full Code Here

            Method methods[] = objectFactory.getDeclaredMethods();
            for (Method method : methods) {
                if (method.getParameterTypes().length == 1
                    && method.getParameterTypes()[0].equals(cls)) {
                   
                    XmlElementDecl elementDecl = method.getAnnotation(XmlElementDecl.class);
                    if (null != elementDecl) {
                        QName elementType = new QName(elementDecl.namespace(), elementDecl.name());
                        registry.registerDeserializer(parentType, elementType, helper);
                        registry.registerSerializer(parentType, elementType, helper);                        
                        registry.mapExtensionTypes(parentType, elementType, cls);
                        found = true;
                    }                   
View Full Code Here

        return cachedContextAndSchemas;
    }

    private boolean checkObjectFactoryNamespaces(Class<?> clz) {
        for (Method meth : clz.getMethods()) {
            XmlElementDecl decl = meth.getAnnotation(XmlElementDecl.class);
            if (decl != null
                && StringUtils.isEmpty(decl.namespace())) {
                return true;
            }
        }

        return false;
View Full Code Here

            Method methods[] = objectFactory.getDeclaredMethods();
            for (Method method : methods) {
                if (method.getParameterTypes().length == 1
                    && method.getParameterTypes()[0].equals(cls)) {
                   
                    XmlElementDecl elementDecl = method.getAnnotation(XmlElementDecl.class);
                    if (null != elementDecl) {
                        QName elementType = new QName(elementDecl.namespace(), elementDecl.name());
                        registry.registerDeserializer(parentType, elementType, helper);
                        registry.registerSerializer(parentType, elementType, helper);                        
                        registry.mapExtensionTypes(parentType, elementType, cls);                       
                        registry.createExtension(parentType, elementType);
                    }                   
View Full Code Here

TOP

Related Classes of javax.xml.bind.annotation.XmlElementDecl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.