Examples of canConvert()


Examples of com.thoughtworks.xstream.converters.Converter.canConvert()

                annotations.add(converterAnnotation);
            }
            for (final XStreamConverter annotation : annotations) {
                final Converter converter = cacheConverter(annotation, converterAnnotation != null ? type : null);
                if (converter != null) {
                    if (converterAnnotation != null || converter.canConvert(type)) {
                        converterRegistry.registerConverter(converter, annotation.priority());
                    } else {
                        throw new InitializationException("Converter "
                            + annotation.value().getName()
                            + " cannot handle annotated class "
View Full Code Here

Examples of com.thoughtworks.xstream.converters.Converter.canConvert()

            for (final XStreamConverter annotation : annotations) {
                final Class<? extends ConverterMatcher> converterType = annotation.value();
                final Converter converter = cacheConverter(
                    converterType, converterAnnotation != null ? type : null);
                if (converter != null) {
                    if (converterAnnotation != null || converter.canConvert(type)) {
                        converterRegistry.registerConverter(converter, XStream.PRIORITY_NORMAL);
                    } else {
                        throw new InitializationException("Converter "
                            + converterType.getName()
                            + " cannot handle annotated class "
View Full Code Here

Examples of com.thoughtworks.xstream.converters.Converter.canConvert()

            return cachedConverter;
        }
        Iterator iterator = converters.iterator();
        while (iterator.hasNext()) {
            Converter converter = (Converter) iterator.next();
            if (converter.canConvert(type)) {
                typeToConverterMap.put(type, converter);
                return converter;
            }
        }
        throw new ConversionException("No converter specified for " + type);
View Full Code Here

Examples of com.thoughtworks.xstream.converters.Converter.canConvert()

        if (cachedConverter != null) return cachedConverter;
        Class mapType = mapper.defaultImplementationOf(type);
        Iterator iterator = converters.iterator();
        while (iterator.hasNext()) {
            Converter converter = (Converter) iterator.next();
            if (converter.canConvert(mapType)) {
                typeToConverterMap.put(type, converter);
                return converter;
            }
        }
        throw new ConversionException("No converter specified for " + type);
View Full Code Here

Examples of com.thoughtworks.xstream.converters.Converter.canConvert()

            }
            for (final XStreamConverter annotation : annotations) {
                final Class<? extends ConverterMatcher> converterType = annotation.value();
                final Converter converter = cacheConverter(converterType);
                if (converter != null) {
                    if (converterAnnotation != null || converter.canConvert(type)) {
                        converterRegistry.registerConverter(converter, XStream.PRIORITY_NORMAL);
                    } else {
                        throw new InitializationException("Converter "
                            + converterType.getName()
                            + " cannot handle annotated class "
View Full Code Here

Examples of com.thoughtworks.xstream.converters.Converter.canConvert()

        Converter cachedConverter = (Converter) typeToConverterMap.get(type);
        if (cachedConverter != null) return cachedConverter;
        Iterator iterator = converters.iterator();
        while (iterator.hasNext()) {
            Converter converter = (Converter) iterator.next();
            if (converter.canConvert(type)) {
                typeToConverterMap.put(type, converter);
                return converter;
            }
        }
        throw new ConversionException("No converter specified for " + type);
View Full Code Here

Examples of com.thoughtworks.xstream.converters.SingleValueConverter.canConvert()

*/
public class ToStringConverterTest extends TestCase {

    public void testClaimsCanConvertRightType() throws NoSuchMethodException {
        SingleValueConverter converter = new ToStringConverter(Foo.class);
        assertTrue(converter.canConvert(Foo.class));
    }

    public void testClaimsCantConvertWrongType() throws NoSuchMethodException {
        SingleValueConverter converter = new ToStringConverter(Foo.class);
        assertFalse(converter.canConvert(Map.class));
View Full Code Here

Examples of com.thoughtworks.xstream.converters.SingleValueConverter.canConvert()

        assertTrue(converter.canConvert(Foo.class));
    }

    public void testClaimsCantConvertWrongType() throws NoSuchMethodException {
        SingleValueConverter converter = new ToStringConverter(Foo.class);
        assertFalse(converter.canConvert(Map.class));
    }

    public void testClaimsCantConvertWrongType2() {
        try {
            new ToStringConverter(Map.class);
View Full Code Here

Examples of com.thoughtworks.xstream.converters.SingleValueConverter.canConvert()

    public void testCanBeUsedForCustomTypes() {
        Software software = new Software("Joe Walnes", "XStream");
        SingleValueConverter converter = new PropertyEditorCapableConverter(
            SoftwarePropertyEditor.class, Software.class);
        assertTrue(converter.canConvert(Software.class));
        assertEquals("Joe Walnes:XStream", converter.toString(software));
        assertEquals(software, converter.fromString("Joe Walnes:XStream"));
    }

    public void testConcurrentConversion() throws InterruptedException {
View Full Code Here

Examples of com.thoughtworks.xstream.converters.enums.EnumConverter.canConvert()

                JqPlotResources plugin = (JqPlotResources) source;
                writer.setValue(plugin.getClassName());
            }
        };

        converter.canConvert(JqPlotResources.class);

        xstream.registerConverter(converter);

        return xstream.toXML(jqPlot);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.