01: /*
02: * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
03: * Distributed under the terms of either:
04: * - the common development and distribution license (CDDL), v1.0; or
05: * - the GNU Lesser General Public License, v2.1 or later
06: * $Id: Formatter.java 3634 2007-01-08 21:42:24Z gbevin $
07: */
08: package com.uwyn.rife.cmf.format;
09:
10: import com.uwyn.rife.cmf.Content;
11: import com.uwyn.rife.cmf.format.exceptions.FormatException;
12: import com.uwyn.rife.cmf.transform.ContentTransformer;
13:
14: /**
15: * Formats raw data according to the information that's provided by a {@link
16: * com.uwyn.rife.cmf.Content Content} instance. The raw data will be
17: * loaded, optionally transformed and eventually returned.
18: *
19: * @author Geert Bevin (gbevin[remove] at uwyn dot com)
20: * @version $Revision: 3634 $
21: * @since 1.0
22: */
23: public interface Formatter<DataType, InternalType> {
24: /**
25: * Formats raw data and returns it in a <code>DataType</code> that's
26: * supported by the back-end stores.
27: *
28: * @param content a <code>Content</code> instance that contains the raw
29: * data with additional information that describes the storage and
30: * formatting of the processed data
31: * @param transformer a transformer that will be used to modify raw data
32: * after it has been loaded; or
33: * <p><code>null</code> if the data shouldn't be transformed
34: * @return the result of the formatting of the raw data
35: * @since 1.0
36: */
37: public DataType format(Content content,
38: ContentTransformer<InternalType> transformer)
39: throws FormatException;
40: }
|