Package org.jibx.binding.model

Examples of org.jibx.binding.model.MappingElement


                    detail.setAttribute("ns", tname.getNamespaceURI());
                    detail.setAttribute("name", tname.getLocalPart());
                    detail.setAttribute("type-index", clsindex);
                    bindinit.appendChild(detail);
                    if (mappedclass == null) {
                        MappingElement mapping = (MappingElement)complexTypeMap.get(tname);
                        mappedclass = mapping.getClassName();
                    }
                }
            }
            if (mappedclass == null) {
                mappedclass = "";
View Full Code Here


                       
                    } else {
                       
                        // complex type translates to abstract mapping in binding
                        complex = true;
                        MappingElement mapping = (MappingElement)complexTypeMap.get(typename);
                        if (mapping == null) {
                            throw new RuntimeException("Cannot unwrap element " +
                                qname + ": no abstract mapping definition found for type " +
                                typename + " (used by element " + itemname + ')');
                        }
                        Integer tindex = (Integer)typeMappedClassMap.get(typename);
                        if (tindex == null) {
                            tindex = new Integer(typeMappedClassMap.size());
                            typeMappedClassMap.put(typename, tindex);
                        }
                        javatype = mapping.getClassName();
                        param.setAttribute("form", "complex");
                        param.setAttribute("type-index", tindex.toString());
                       
                        // merge contained namespace definitions into set for operation
                        Iterator citer = mapping.topChildIterator();
                        while (citer.hasNext()) {
                            ElementBase child = (ElementBase)citer.next();
                            if (child.type() == ElementBase.NAMESPACE_ELEMENT) {
                                dfltns = mapNamespace((NamespaceElement)child, dfltns, nsmap);
                            } else {
View Full Code Here

    private String mapQName(QName qname, Map complexTypeMap) throws RuntimeException {
        Object obj = complexTypeMap.get(qname);
        if (obj == null) {
            throw new RuntimeException("No mapping defined for element " + qname);
        }
        MappingElement mapping = (MappingElement)obj;
        String cname = mapping.getClassName();
        codeGenConfig.getTypeMapper().addTypeMappingName(qname, cname);
        return cname;
    }
View Full Code Here

                FormatElement format = (FormatElement)child;
                registerElement(format.getQName(), format, simpleTypeMap);
                bindingMap.put(format, binding);
               
            } else if (child.type() == ElementBase.MAPPING_ELEMENT) {
                MappingElement mapping = (MappingElement)child;
                bindingMap.put(mapping, binding);
                if (mapping.isAbstract()) {
                   
                    // register named abstract mappings as complex type conversions
                    registerElement(mapping.getTypeQName(), mapping,
                        complexTypeMap);
                   
                } else {
                   
                    // register concrete mappings as element conversions
                    String uri = mapping.getUri();
                    if (uri == null) {
                        uri = findDefaultNS(mapping.topChildIterator(),
                            defaultns);
                    }
                    elementMap.put(new QName(uri, mapping.getName()), mapping);
                }
            }
        }
    }
View Full Code Here

            }
        };
        ctx.tourTree(holder.getBinding(), visitor);
    }
    public String getType(QName qn, boolean element) {
        MappingElement mappingElement = element ? elements.get(jibxQName(qn)) : types.get(jibxQName(qn));
        return (mappingElement == null) ? null : mappingElement.getClassName();
    }
View Full Code Here

        MappingElement mappingElement = element ? elements.get(jibxQName(qn)) : types.get(jibxQName(qn));
        return (mappingElement == null) ? null : mappingElement.getClassName();
    }

    public String getWrappedElementType(QName wrapperElement, QName item) {
        MappingElement mappingElement = elements.get(jibxQName(wrapperElement));
        return (mappingElement == null) ? null : itemType(mappingElement, item);
    }
View Full Code Here

            problemHandler.handleSevere("", e);
        }
    }

    public String getType(QName qn, boolean element) {
        MappingElement mappingElement = element ? elements.get(jibxQName(qn)) : types.get(jibxQName(qn));
        return (mappingElement == null) ? null : mappingElement.getClassName();
    }
View Full Code Here

        MappingElement mappingElement = element ? elements.get(jibxQName(qn)) : types.get(jibxQName(qn));
        return (mappingElement == null) ? null : mappingElement.getClassName();
    }

    public String getWrappedElementType(QName wrapperElement, QName item) {
        MappingElement mappingElement = elements.get(jibxQName(wrapperElement));
        return (mappingElement == null) ? null : itemType(mappingElement, item);
    }
View Full Code Here

                    detail.setAttribute("ns", tname.getNamespaceURI());
                    detail.setAttribute("name", tname.getLocalPart());
                    detail.setAttribute("type-index", clsindex);
                    bindinit.appendChild(detail);
                    if (mappedclass == null) {
                        MappingElement mapping = (MappingElement)complexTypeMap.get(tname);
                        mappedclass = mapping.getClassName();
                    }
                }
            }

            // set binding lookup parameters
View Full Code Here

                        }

                    } else {
                       
                        // conversion must be defined by mapping
                        MappingElement mapping;
                        if (refname == null) {

                            // complex type reference translates to abstract mapping in binding
                            mapping = (MappingElement)complexTypeMap.get(typename);
                            if (mapping == null) {
                                throw new RuntimeException("Cannot unwrap element " +
                                        qname + ": no abstract mapping definition found for type " +
                                        typename + " (used by element " + itemname + ')');
                            }
                            Integer tindex = (Integer)typeMappedClassMap.get(typename);
                            if (tindex == null) {
                                tindex = new Integer(typeMappedClassMap.size());
                                typeMappedClassMap.put(typename, tindex);
                            }
                            param.setAttribute("type-index", tindex.toString());
                           
                        } else {
                           
                            // element reference translates to concrete mapping
                            mapping = (MappingElement)elementMap.get(refname);
                            if (mapping == null) {
                                throw new RuntimeException("Cannot unwrap element " +
                                        qname + ": no concrete mapping definition found for element " +
                                        refname + " (used by element " + itemname + ')');
                            }
                            param.setAttribute("type-index", "");
                           
                        }

                        // configure based on the mapping information
                        param.setAttribute("form", "complex");
                        complex = true;
                        javatype = mapping.getClassName();
                        createtype = mapping.getCreateType();
                        if (createtype == null && mapping.isAbstract() &&
                            mapping.getExtensionTypes().isEmpty()) {
                           
                            // abstract mapping with no extensions requires instance
                            //  this assumes the mapped type can be created, but no easy way to check
                            createtype = javatype;
                        }

                        // merge contained namespace definitions into set for operation
                        Iterator citer = mapping.topChildIterator();
                        while (citer.hasNext()) {
                            ElementBase child = (ElementBase)citer.next();
                            if (child.type() == ElementBase.NAMESPACE_ELEMENT) {
                                dfltns = mapNamespace((NamespaceElement)child, dfltns, nsmap);
                            } else {
View Full Code Here

TOP

Related Classes of org.jibx.binding.model.MappingElement

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.