KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > columba > addressbook > model > BasicModelPartial


1 // The contents of this file are subject to the Mozilla Public License Version
2
// 1.1
3
//(the "License"); you may not use this file except in compliance with the
4
//License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
5
//
6
//Software distributed under the License is distributed on an "AS IS" basis,
7
//WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
8
//for the specific language governing rights and
9
//limitations under the License.
10
//
11
//The Original Code is "The Columba Project"
12
//
13
//The Initial Developers of the Original Code are Frederik Dietz and Timo
14
// Stich.
15
//Portions created by Frederik Dietz and Timo Stich are Copyright (C) 2003.
16
//
17
//All Rights Reserved.
18
package org.columba.addressbook.model;
19
20 /**
21  * @author fdietz
22  *
23  */

24 public class BasicModelPartial implements IBasicModelPartial {
25
26     protected boolean contact;
27
28     protected String JavaDoc id;
29
30     protected String JavaDoc name;
31
32     protected String JavaDoc description;
33
34     /**
35      * Default constructor
36      *
37      */

38     public BasicModelPartial(boolean contact) {
39         this.contact = contact;
40     }
41
42     public BasicModelPartial(String JavaDoc id, boolean contact) {
43         if (id == null)
44             throw new IllegalArgumentException JavaDoc("id == null");
45
46         this.contact = contact;
47         this.id = id;
48     }
49
50     public BasicModelPartial(String JavaDoc id, String JavaDoc name, boolean contact) {
51         this(id, contact);
52
53         if (name == null)
54             throw new IllegalArgumentException JavaDoc("name == null");
55
56         this.name = name;
57     }
58
59     /**
60      * @return Returns the contact.
61      */

62     public boolean isContact() {
63         return contact;
64     }
65
66     /**
67      * @see java.lang.Object#toString()
68      */

69     public String JavaDoc toString() {
70         return name;
71     }
72
73     public String JavaDoc getId() {
74         return id;
75     }
76
77     public String JavaDoc getName() {
78         return name;
79     }
80
81     public String JavaDoc getDescription() {
82         return description;
83     }
84
85     public void setDescription(String JavaDoc description) {
86         this.description = description;
87     }
88
89     public IBasicModelPartial clone() {
90         IBasicModelPartial p = new BasicModelPartial(id, name, contact);
91         return p;
92     }
93 }
Popular Tags