KickJava   Java API By Example, From Geeks To Geeks.

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


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  * Corresponds to the <Ext> element in the SyncML devinf DTD and specifies
26  * the non-standard, experimental extensions supported by the device.
27  *
28  * @author Stefano Fornari @ Funambol
29  *
30  * @version $Id: Ext.java,v 1.4 2005/03/02 20:57:37 harrie Exp $
31  */

32 public final class Ext
33 implements java.io.Serializable JavaDoc {
34
35     // ------------------------------------------------------------ Private data
36
private String JavaDoc xNam;
37     private ArrayList xVal = new ArrayList();
38
39     // ------------------------------------------------------------ Constructors
40
/**
41      * In order to expose the server configuration like WS this constructor
42      * must be public
43      */

44     public Ext() {}
45
46     /**
47      * Creates a new Ext object with the given name and value
48      *
49      * @param xNam corresponds to the <XNam> element - NOT NULL
50      * @param xVal an array of parameters that corresponds to the &ltXVal&gt
51      * element
52      *
53      */

54     public Ext(final String JavaDoc xNam, final String JavaDoc[] xVal) {
55         setXNam(xNam);
56         setXVal(xVal);
57     }
58
59     // ---------------------------------------------------------- Public methods
60
/**
61      * Gets the name of the extension
62      *
63      * @return the name of the extension
64      */

65     public String JavaDoc getXNam() {
66         return xNam;
67     }
68
69     /**
70      * Sets the name of extension
71      *
72      * @param xNam the name of extension
73      *
74      */

75     public void setXNam(String JavaDoc xNam) {
76         if (xNam == null) {
77             throw new IllegalArgumentException JavaDoc("XNam cannot be null");
78         }
79         this.xNam = xNam;
80     }
81
82     /**
83      * Gets an array of extension values, if exist
84      *
85      * @return an array of extension values, if exist
86      */

87     public ArrayList getXVal() {
88         return xVal;
89     }
90
91     /**
92      * Sets the array of extension value
93      *
94      * @param xVal the array of extension value
95      *
96      */

97     public void setXVal(String JavaDoc[] xVal) {
98         if (xVal == null) {
99             throw new IllegalArgumentException JavaDoc("xVal cannot be null");
100         }
101         this.xVal.clear();
102         this.xVal.addAll(Arrays.asList(xVal));
103     }
104 }
Popular Tags