KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > sync4j > syncclient > sps > common > FieldMetadata


1 /**
2  * Copyright (C) 2003-2005 Funambol
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program 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
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  */

18
19 package sync4j.syncclient.sps.common;
20
21 import java.util.Hashtable JavaDoc;
22
23 /**
24  * This class create FieldMetadata
25  *
26  * @author Fabio Maggi @ Funambol
27  * $Id: FieldMetadata.java,v 1.4 2005/01/19 11:18:36 fabius Exp $
28  */

29 public abstract class FieldMetadata {
30
31     //-------------------------------------------------------------- Private data
32

33     private String JavaDoc fieldName = null;
34     private String JavaDoc fieldType = null;
35
36     private Hashtable JavaDoc fieldAttributes = new Hashtable JavaDoc();
37
38     //------------------------------------------------------------- Constructors
39

40     public FieldMetadata(String JavaDoc fieldName, String JavaDoc fieldType, Hashtable JavaDoc fieldAttributes) throws DatabaseException {
41
42         this.fieldName = fieldName ;
43         this.fieldType = fieldType ;
44         this.fieldAttributes = fieldAttributes ;
45
46         if(!validateAttributes(fieldName, fieldType, fieldAttributes)) {
47
48             throw new DatabaseException("Error in fieldAttributes");
49
50         }
51
52     }
53
54     //----------------------------------------------------------- Public methods
55

56     /**
57      * @return fieldName
58      **/

59     public String JavaDoc getName() {
60         return this.fieldName;
61     }
62
63     /**
64      * @return fieldType
65      **/

66     public String JavaDoc getType() {
67         return this.fieldType;
68
69     }
70
71     /**
72      * @return fieldAttributes
73      **/

74     public Hashtable JavaDoc getAttributes() {
75         return this.fieldAttributes;
76     }
77
78     /**
79      * validate fieldAttributes
80      *
81      * @param fieldName
82      * @param fieldType
83      * @param fieldAttributes
84      **/

85
86     public abstract boolean validateAttributes(String JavaDoc fieldName ,
87                                                String JavaDoc fieldType ,
88                                                Hashtable JavaDoc fieldAttributes );
89
90 }
Popular Tags