KickJava   Java API By Example, From Geeks To Geeks.

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


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 /**
23  * Corresponds to the <VerDTD> tag in the SyncML devinf DTD
24  *
25  * @author Stefano Fornari @ Funambol
26  *
27  * @version $Id: VerDTD.java,v 1.5 2005/03/02 20:57:37 harrie Exp $
28  */

29 public final class VerDTD
30 implements java.io.Serializable JavaDoc {
31
32     // ------------------------------------------------------------ Private data
33

34     private String JavaDoc value;
35
36     // ------------------------------------------------------------ Constructors
37

38     /**
39      * In order to expose the server configuration like WS this constructor
40      * must be public
41      */

42     public VerDTD() {}
43
44     /**
45      * Creates a new VerDTD object with the given value
46      *
47      * @param value the version - NOT NULL
48      *
49      */

50     public VerDTD(final String JavaDoc value) {
51         setValue(value);
52     }
53
54     // ---------------------------------------------------------- Public methods
55

56     /**
57      * Gets value properties
58      *
59      * @return value properties
60      */

61     public String JavaDoc getValue() {
62         return value;
63     }
64
65     /**
66      * Sets the version of DTD
67      *
68      * @param value the version of DTD
69      */

70     public void setValue(String JavaDoc value) {
71         if ((value == null) || (value.length() == 0)) {
72             throw new IllegalArgumentException JavaDoc("value cannot be null or empty");
73         }
74         this.value = value;
75     }
76
77     /**
78      * Compares the string value to the specified input object.
79      *
80      * @param obj the object to be compared
81      *
82      * @return true if the specified input object equals the value of the
83      * VerDTD object
84      *
85      */

86     public boolean equals(Object JavaDoc obj) {
87         if ((obj instanceof VerDTD) == false) {
88             return false;
89         }
90         return (((VerDTD) obj).getValue().equals(value));
91     }
92 }
93
Popular Tags