Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package jpaoletti.jpm.parser;
 
This is not a recursive class! This is an xstream converter for the pm.core.converter.Converter class.

Author(s):
jpaoletti
    @Override
    public void marshal(Object oHierarchicalStreamWriter writerMarshallingContext mc) {
        final Converters converters = (Converterso;
        writer.startNode("converters");
        for (Converter c : converters.getConverters()) {
            writer.startNode("converter");
            mc.convertAnother(c);
            writer.endNode();
        }
        for (ExternalConverter c : converters.getExternalConverters()) {
            writer.startNode("econverter");
            mc.convertAnother(c);
            writer.endNode();
        }
        writer.endNode();
    }
    @Override
        final Converters converters = new Converters();
        converters.setConverters(new ArrayList<Converter>());
        converters.setExternalConverters(new ArrayList<ExternalConverter>());
        while (reader.hasMoreChildren()) {
            reader.moveDown();
            if (reader.getNodeName().equals("converter")) {
                final String clazz = reader.getAttribute("class");
                try {
                    final Converter c = (Converteruc.convertAnother(converters, Class.forName(clazz));
                    converters.getConverters().add(c);
                } catch (Exception ex) {
                    PresentationManager.getPm().warn("Converter not found: " + clazz);
                }
            } else if (reader.getNodeName().equals("econverter")) {
                ExternalConverter c = (ExternalConverteruc.convertAnother(convertersExternalConverter.class);
                converters.getExternalConverters().add(c);
            }
            reader.moveUp();
        }
        return converters;
    }
    @Override
    public boolean canConvert(Class type) {
        return type.equals(Converters.class);
    }
New to GrepCode? Check out our FAQ X