01: /*
02: * Copyright (c) 2001 - 2005 ivata limited.
03: * All rights reserved.
04: * ---------------------------------------------------------
05: * ivata masks may be redistributed under the GNU General Public
06: * License as published by the Free Software Foundation;
07: * version 2 of the License.
08: *
09: * These programs are free software; you can redistribute them and/or
10: * modify them under the terms of the GNU General Public License
11: * as published by the Free Software Foundation; version 2 of the License.
12: *
13: * These programs are distributed in the hope that they will be useful,
14: * but WITHOUT ANY WARRANTY; without even the implied warranty of
15: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16: *
17: * See the GNU General Public License in the file LICENSE.txt for more
18: * details.
19: *
20: * If you would like a copy of the GNU General Public License write to
21: *
22: * Free Software Foundation, Inc.
23: * 59 Temple Place - Suite 330
24: * Boston, MA 02111-1307, USA.
25: *
26: *
27: * To arrange commercial support and licensing, contact ivata at
28: * http://www.ivata.com/contact.jsp
29: * ---------------------------------------------------------
30: * $Log: FieldValueConvertorFactory.java,v $
31: * Revision 1.1 2005/04/11 12:27:02 colinmacleod
32: * Added preliminary support for filters.
33: * Added FieldValueConvertor factor interface
34: * to split off value convertors for reuse.
35: *
36: * ---------------------------------------------------------
37: */
38: package com.ivata.mask.field;
39:
40: import com.ivata.mask.util.SystemException;
41:
42: /**
43: * Creates an appropriate field value convertor for a given property type.
44: *
45: * @since ivata masks 0.6 (2005-03-17)
46: * @author Colin MacLeod
47: * <a href='mailto:colin.macleod@ivata.com'>colin.macleod@ivata.com</a>
48: * @version $Revision: 1.1 $
49: */
50:
51: public interface FieldValueConvertorFactory {
52: /**
53: * <p>
54: * Find the appropriate convertor for the field value class provided.
55: * This method goes thro' all the parent classes of the class provided
56: * till it finds a suitable convertor.
57: * </p>
58: *
59: * @param fieldValueClass Class of the field value we are tryinh to convert
60: * from a string.
61: * @return value field value convertor.
62: * @throws SystemException thrown if there is a class in the hierarchy
63: * for which we have no field value convertor.
64: */
65: FieldValueConvertor getFieldValueConvertorForClass(
66: final Class fieldValueClass) throws SystemException;
67:
68: /**
69: * <p>
70: * Set the field value convertor to use for a particular class.
71: * </p>
72: *
73: * @param fieldClass
74: * class to be converted.
75: * @param convertor
76: * convertor to use for this class.
77: */
78: void setFieldValueConvertor(final Class fieldClass,
79: final FieldValueConvertor convertor);
80: }
|