KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > sync4j > framework > core > CTTypeSupported


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
20 package sync4j.framework.core;
21
22 import java.util.*;
23
24 /**
25  * This class contains the information on CTCap
26  *
27  * @author Stefano Fornari @ Funambol
28  *
29  * @version $Id: CTTypeSupported.java,v 1.5 2005/03/02 20:57:37 harrie Exp $
30  */

31 public final class CTTypeSupported
32 implements java.io.Serializable JavaDoc {
33
34     // ------------------------------------------------------------ Private data
35
private String JavaDoc ctType;
36     private ArrayList ctPropParams = new ArrayList();
37     
38     // ------------------------------------------------------------ Constructors
39
/** For serialization purposes */
40     protected CTTypeSupported() {}
41     
42     /**
43      * Creates a new CTTypeSupported object with the given information
44      *
45      * @param ctType an String CTType - NOT NULL
46      * @param ctPropParams the array of content type properties and/or content
47      * content type parameters - NOT NULL
48      *
49      */

50     public CTTypeSupported(final String JavaDoc ctType,
51                            final CTPropParam[] ctPropParams ) {
52         setCTType(ctType);
53         setCTPropParams(ctPropParams);
54     }
55     
56     // ---------------------------------------------------------- Public methods
57

58     /**
59      * Get a CTType String
60      *
61      * @return a CTType String
62      */

63     public String JavaDoc getCTType() {
64         return this.ctType;
65     }
66     
67     /**
68      * Sets a CTType object
69      *
70      * @param ctType a CTType object
71      */

72     public void setCTType(String JavaDoc ctType) {
73         if (ctType == null || ctType.length() == 0) {
74             throw new IllegalArgumentException JavaDoc("ctType cannot be null");
75         }
76         this.ctType = ctType;
77     }
78     
79     /**
80      * Gets an array of content type properties and parameters
81      *
82      * @return an array of content type properties and parameters
83      *
84      */

85     public ArrayList getCTPropParams() {
86         return this.ctPropParams;
87     }
88     
89     /**
90      * Sets an array of content type properties and parameters
91      *
92      * @param ctPropParams array of content type properties and parameters
93      *
94      */

95     public void setCTPropParams(CTPropParam[] ctPropParams) {
96         if (ctPropParams == null) {
97             throw new IllegalArgumentException JavaDoc("ctPropParams cannot be null");
98         }
99         this.ctPropParams.clear();
100         this.ctPropParams.addAll(Arrays.asList(ctPropParams));
101     }
102 }
103
Popular Tags