KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > speedo > api > UserFieldMapping


1 /**
2  * Copyright (C) 2001-2004 France Telecom R&D
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  */

18 package org.objectweb.speedo.api;
19
20 /**
21  * This interface permits to the user to convert a value store a support into
22  * the value used in its persistent object. For example you can store a Date
23  * value as a long in your data support and view this value as a java.util.Date
24  * in youur application. It is the role of the persistent object provider to
25  * implement this interface for each field which the type does not match to the
26  * type into the data support. This converter can be only used for primitive
27  * type, ie the memory type cannot be a reference to a persistent object.
28  *
29  * @author S.Chassande-Barrioz
30  */

31 public interface UserFieldMapping {
32
33     /**
34      * Retrieves the java type corresponding to the type into the data support.
35      * @return a Class object (never null).
36      */

37     Class JavaDoc getStorageType();
38
39     /**
40      * Retrieves the java type corresponding to the type in memory.
41      * @return a Class object (never null).
42      */

43     Class JavaDoc getMemoryType();
44
45     /**
46      * Converts a value from the data support into a value in memory
47      * @param storagevalue is the value store in the support (can be null).
48      * @return the value in memory (can be null).
49      */

50     Object JavaDoc toMemory(Object JavaDoc storagevalue);
51
52     /**
53      * Converts a value from the data support into a value in memory
54      * @param memoryvalue the value in memory (can be null).
55      * @return is the value store in the support (can be null).
56      */

57     Object JavaDoc toStorage(Object JavaDoc memoryvalue);
58 }
59
Popular Tags