KickJava   Java API By Example, From Geeks To Geeks.

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


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  * This class represents the <MapItem> tag as defined by the SyncML r
24  * epresentation specifications.
25  *
26  * @author Stefano Fornari @ Funambol
27  *
28  * @version $Id: MapItem.java,v 1.4 2005/03/02 20:57:37 harrie Exp $
29  *
30  */

31 public final class MapItem
32 implements java.io.Serializable JavaDoc {
33     
34     // ------------------------------------------------------------ Private data
35

36     private Target target;
37     private Source source;
38     
39     // ------------------------------------------------------------ Constructors
40

41     /**
42      * This is for serialization purposes
43      */

44     protected MapItem() {}
45     
46     /**
47      * Creates a MapItem object from its target and source.
48      *
49      * @param target the mapping target - NOT NULL
50      * @param source the mapping source - NOT NULL
51      *
52      * @throws IllegalArgumentException if any parameter is null
53      *
54      */

55     public MapItem(final Target target, final Source source) {
56         setTarget(target);
57         setSource(source);
58     }
59     
60     // ---------------------------------------------------------- Public methods
61

62     /**
63      * Returns the MapItem's target
64      *
65      * @return Tthe MapItem's target
66      *
67      */

68     public Target getTarget() {
69         return target;
70     }
71     
72     /**
73      * Sets the MapItem's target
74      *
75      * @param target he MapItem's target - NOT NULL
76      *
77      * @throws IllegalArgumentException if target is null
78      */

79     public void setTarget(Target target) {
80         if (target == null) {
81             throw new IllegalArgumentException JavaDoc("target cannot be null");
82         }
83         this.target = target;
84     }
85     
86     /**
87      * Returns the MapItem's source
88      *
89      * @return Tthe MapItem's source
90      *
91      */

92     public Source getSource() {
93         return source;
94     }
95     
96     /**
97      * Sets the MapItem's source
98      *
99      * @param source he MapItem's source - NOT NULL
100      *
101      * @throws IllegalArgumentException if source is null
102      */

103     public void setSource(Source source) {
104         if (source == null) {
105             throw new IllegalArgumentException JavaDoc("source cannot be null");
106         }
107         this.source = source;
108     }
109 }
110
Popular Tags