Package fr.soleil.salsa.persistence.converter

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


    public Object fromXml(Class<?> _c, Element _xml, ConverterData _cd)
            throws IllegalArgumentException, ClassNotFoundException,
            IllegalAccessException, InstantiationException {

        ArrayList<Object> result = new ArrayList<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;
    }
View Full Code Here


        Document d = _xml.getOwnerDocument();
        Element result = d.createElement(getFieldName());
        _xml.appendChild(result);

        ComplexTypeConverter ctc = _cd.getConverterHT().get(getType());

        List<Object> list = castToObjectList(_o);
        for (int i = 0; i < list.size(); i++) {

            Element itemXml = d.createElement(getFieldName());
            result.appendChild(itemXml);

            Object item = list.get(i);
            ctc.toXml(itemXml, item, _cd);
        }
    }
View Full Code Here

     */
    public Object fromXml(Class<?> _c, Element _xml, ConverterData _cd)
            throws IllegalArgumentException, ClassNotFoundException,
            IllegalAccessException, InstantiationException {

        ComplexTypeConverter ctc = _cd.getConverterHT().get(getType());
        Object result = ctc.fromXml(null, _xml, _cd);
        return result;
    }
View Full Code Here

            IllegalAccessException {
        Document d = _xml.getOwnerDocument();
        Element result = d.createElement(fieldName);
        _xml.appendChild(result);

        ComplexTypeConverter ctc = _cd.getConverterHT().get(type);
        ctc.toXml(result, _o, _cd);
    }
View Full Code Here

     */
    public Object fromXml(Class<?> _c, Element _xml, ConverterData _cd)
            throws IllegalArgumentException, ClassNotFoundException,
            IllegalAccessException, InstantiationException {
        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;
    }
View Full Code Here

        if(_o == null) {return ;}
       
        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);
        }
    }
View Full Code Here

    @Override
    public Object fromXml(Class<?> _c, Element _xml, ConverterData _cd) throws ConversionException {

        try {
            ArrayList<Object> result = new ArrayList<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());

            List<Object> list = castToObjectList(_o);
            for (int i = 0; i < list.size(); i++) {

                Element itemXml = d.createElement(getFieldName());
                result.appendChild(itemXml);

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

    }

    @Override
    public Object fromXml(Class<?> _c, Element _xml, ConverterData _cd) throws ConversionException {

        ComplexTypeConverter ctc = _cd.getConverterHT().get(getType());
        Object result;
        try {
            result = ctc.fromXml(null, _xml, _cd);
        }
        catch (Exception e) {
            throw new ConversionException(e.getMessage(), e);
        }
        return result;
View Full Code Here

    public void toXml(Element _xml, Object _o, ConverterData _cd) throws ConversionException {
        Document d = _xml.getOwnerDocument();
        Element result = d.createElement(fieldName);
        _xml.appendChild(result);

        ComplexTypeConverter ctc = _cd.getConverterHT().get(type);
        try {
            ctc.toXml(result, _o, _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.