001    // Copyright 2007 Waterken Inc. under the terms of the MIT X license
002    // found at http://www.opensource.org/licenses/mit-license.html
003    package org.waterken.syntax;
004    
005    import java.lang.reflect.Type;
006    
007    import org.joe_e.Powerless;
008    import org.joe_e.array.ByteArray;
009    import org.joe_e.array.ConstArray;
010    
011    /**
012     * An object serializer.
013     */
014    public interface
015    Serializer extends Powerless {
016        
017        /**
018         * Serializes an object.
019         * @param export    reference exporter
020         * @param type      implict type for <code>value</code>  
021         * @param value     value to serialize
022         * @return serialized content
023         */
024        ByteArray serialize(Exporter export,Type type,Object value)throws Exception;
025        
026        /**
027         * Serializes a tuple.
028         * @param export    reference exporter
029         * @param types     each implict type for <code>values</code>  
030         * @param values    values to serialize
031         * @return serialized content
032         */
033        ByteArray serializeTuple(Exporter export, ConstArray<Type> types,
034                                 ConstArray<?> values) throws Exception;
035    }