Package de.timefinder.core.io.text

Examples of de.timefinder.core.io.text.Writing


        for (Constraint constr : co.getConstraints()) {
            Element el = newElement.addElement(constr.getClass().getSimpleName());
            el.addAttribute("weight", "" + constr.getWeight());
            if (constr instanceof RasterConstraint) {
                RasterConstraint rc = (RasterConstraint) constr;
                Writing w = getWriting(BitSet.class);
                el.setText(w.toString(rc.getRaster().getForbidden()));
                el.addAttribute("length", "" + rc.getRaster().getForbidden().getLength());
            } else if (constr instanceof EventOrderConstraint) {
                EventOrderConstraint eoc = (EventOrderConstraint) constr;
                el.addElement("event").addAttribute("ref", "" + eoc.getEvent().getId());
                for (Event ev : eoc.getBefores()) {
View Full Code Here


                if (m == null)
                    throw new IllegalStateException("No getter found for " + property);

                Object result = m.invoke(object);
                if (result != null) {
                    Writing writing = getWriting(m.getReturnType());
                    if (writing == null)
                        throw new UnsupportedOperationException("No writing found for " + m.getReturnType());

                    element.addElement(property).setText(writing.toString(result));
                }
            } catch (Exception ex) {
                throw new RuntimeException("exception while writing "
                        + property + " from "
                        + object.getClass().getName() + " " + object, ex);
View Full Code Here

        Element settingsElement = document.addElement("settings");
        settingsElement.addAttribute("version", "4.1");

        for (Entry<String, Object> entry : settingsMap.entrySet()) {
            Class clazz = entry.getValue().getClass();
            Writing w = objWriting.getWriting(clazz);
            if (w == null)
                throw new UnsupportedOperationException("No writing implemented for class:" + clazz);

            settingsElement.addElement(entry.getKey()).
                    addAttribute("class", clazz.getName()).
                    setText(w.toString(entry.getValue()));
        }

        XMLWriter output = new XMLWriter(new FileOutputStream(xmlFile), new OutputFormat("  ", true));
        output.write(document);
        output.close();
View Full Code Here

TOP

Related Classes of de.timefinder.core.io.text.Writing

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.