Package fr.soleil.salsa.persistence.converter

Examples of fr.soleil.salsa.persistence.converter.ComplexTypeConverter


    @Override
    public Object fromXml(Class<?> _c, Element _xml, ConverterData _cd) throws ConversionException {
        try {
            HashSet<Object> result = new HashSet<Object>();
            ComplexTypeConverter ctc = _cd.getConverterHT().get(getType());

            NodeList childs = _xml.getChildNodes();
            for (int i = 0; i < childs.getLength(); i++) {
                if (childs.item(i).getNodeType() != Node.ELEMENT_NODE) {
                    continue;
                }
                Element item = (Element) childs.item(i);
                Object o = ctc.fromXml(result, item, _cd);
                result.add(o);
            }
            return result;
        }
        catch (Exception e) {
View Full Code Here


            }

            Document d = _xml.getOwnerDocument();
            Element result = d.createElement(getFieldName());
            _xml.appendChild(result);
            ComplexTypeConverter ctc = _cd.getConverterHT().get(getType());
            Set<Object> list = castToObjectSet(_o);
            Iterator<Object> i = list.iterator();
            while (i.hasNext()) {
                Element itemXml = d.createElement(getFieldName());
                result.appendChild(itemXml);

                Object item = i.next();
                ctc.toXml(itemXml, item, _cd);
            }
        }
        catch (Exception e) {
            throw new ConversionException(e.getMessage(), e);
        }
View Full Code Here

TOP

Related Classes of fr.soleil.salsa.persistence.converter.ComplexTypeConverter

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.