All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.feilong.lib.xstream.converters.Converter Maven / Gradle / Ivy

Go to download

feilong is a suite of core and expanded libraries that include utility classes, http, excel,cvs, io classes, and much much more.

There is a newer version: 4.0.8
Show newest version
/*
 * Copyright (C) 2003, 2004 Joe Walnes.
 * Copyright (C) 2006, 2007, 2013 XStream Committers.
 * All rights reserved.
 *
 * The software in this package is published under the terms of the BSD
 * style license a copy of which has been included with this distribution in
 * the LICENSE.txt file.
 * 
 * Created on 26. September 2003 by Joe Walnes
 */
package com.feilong.lib.xstream.converters;

import com.feilong.lib.xstream.io.HierarchicalStreamReader;
import com.feilong.lib.xstream.io.HierarchicalStreamWriter;

/**
 * Converter implementations are responsible marshalling Java objects
 * to/from textual data.
 * 
 * 

* If an exception occurs during processing, a {@link ConversionException} * should be thrown. *

* *

* If working with the high level {@link com.feilong.lib.xstream.XStream} facade, * you can register new converters using the XStream.registerConverter() method. *

* *

* If working with the lower level API, the * {@link com.feilong.lib.xstream.converters.ConverterLookup} implementation is * responsible for looking up the appropriate converter. *

* *

* Converters for object that can store all information in a single value * should implement {@link com.feilong.lib.xstream.converters.SingleValueConverter}. * {@link com.feilong.lib.xstream.converters.basic.AbstractSingleValueConverter} * provides a starting point. *

* *

* {@link com.feilong.lib.xstream.converters.collections.AbstractCollectionConverter} * provides a starting point for objects that hold a collection of other objects * (such as Lists and Maps). *

* * @author Joe Walnes * @see com.feilong.lib.xstream.XStream * @see com.feilong.lib.xstream.converters.ConverterLookup * @see com.feilong.lib.xstream.converters.basic.AbstractSingleValueConverter * @see com.feilong.lib.xstream.converters.collections.AbstractCollectionConverter */ public interface Converter extends ConverterMatcher{ /** * 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 reader * The stream to read the text from. * @param context * @return The resulting object. */ Object unmarshal(HierarchicalStreamReader reader,UnmarshallingContext context); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy