package com.thoughtworks.xstream.converters; import com.thoughtworks.xstream.io.HierarchicalStreamWriter; import com.thoughtworks.xstream.io.HierarchicalStreamReader; /** * Converter implementations are responsible marshalling Java objects * * @author Paul Hammant * @see com.thoughtworks.xstream.XStream */ public interface AttributeConverter { /** * Called by XStream to determine whether to use this converter * instance to marshall a particular type. */ boolean canConvert(Class type); /** * Convert an object to textual data. * * @param source The object to be marshalled. * @param writer A stream to write to. * @param context A context that allows nested objects to be processed by XStream. */ void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context); /** * Convert textual data back into an object. * * @param instance The instance on which the attribute was found. * @param reader */ void unmarshal(Object instance, HierarchicalStreamReader reader); }