01: /*
02: * Copyright (C) 2007, 2008 XStream Committers.
03: * All rights reserved.
04: *
05: * The software in this package is published under the terms of the BSD
06: * style license a copy of which has been included with this distribution in
07: * the LICENSE.txt file.
08: *
09: * Created on 08.12.2007 by Joerg Schaible
10: */
11: package com.thoughtworks.xstream.converters.extended;
12:
13: import com.thoughtworks.xstream.converters.reflection.ReflectionConverter;
14: import com.thoughtworks.xstream.converters.reflection.ReflectionProvider;
15: import com.thoughtworks.xstream.mapper.Mapper;
16:
17: import javax.swing.LookAndFeel;
18:
19: import java.io.NotSerializableException;
20:
21: /**
22: * A converter for Swing LookAndFeel implementations. The JDK's implementations are serializable
23: * for historical reasons but will throw a {@link NotSerializableException} in their writeObject
24: * method. Therefore XStream will use an implementation based on the ReflectionConverter.
25: *
26: * @author Jörg Schaible
27: * @since 1.3
28: */
29: public class LookAndFeelConverter extends ReflectionConverter {
30:
31: /**
32: * Constructs a LookAndFeelConverter.
33: *
34: * @param mapper the mapper
35: * @param reflectionProvider the reflection provider
36: * @since 1.3
37: */
38: public LookAndFeelConverter(Mapper mapper,
39: ReflectionProvider reflectionProvider) {
40: super (mapper, reflectionProvider);
41: }
42:
43: public boolean canConvert(Class type) {
44: return LookAndFeel.class.isAssignableFrom(type);
45: }
46: }
|