KickJava   Java API By Example, From Geeks To Geeks.

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


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 <Item> tag ias defined by the SyncML
24  * representation specifications
25  *
26  * @author Stefano Fornari @ Funambol
27  *
28  * @version $Id: Item.java,v 1.5 2005/03/02 20:57:37 harrie Exp $
29  */

30 public class Item
31 implements java.io.Serializable JavaDoc {
32
33     // ------------------------------------------------------------ Private data
34
private Target target;
35     private Source source;
36     private Meta meta;
37     private ComplexData data;
38     private Boolean JavaDoc moreData;
39
40     // ------------------------------------------------------------ Constructors
41

42     protected Item() {}
43     
44     /**
45      * Creates a new Item object.
46      *
47      * @param target item target - NULL ALLOWED
48      * @param source item source - NULL ALLOWED
49      * @param meta item meta data - NULL ALLOWED
50      * @param data item data - NULL ALLOWED
51      *
52      */

53     public Item(final Target target,
54                 final Source source,
55                 final Meta meta ,
56                 final ComplexData data,
57                 final boolean moreData) {
58         this.target = target;
59         this.source = source;
60         this.meta = meta ;
61         this.data = data ;
62         this.moreData = (moreData) ? new Boolean JavaDoc(moreData) : null;
63     }
64
65     // ---------------------------------------------------------- Public methods
66

67     /**
68      * Returns the item target
69      *
70      * @return the item target
71      */

72     public Target getTarget() {
73         return target;
74     }
75     
76     /**
77      * Sets the item target
78      *
79      * @param target the target
80      *
81      */

82     public void setTarget(Target target) {
83         this.target = target;
84     }
85     
86     /**
87      * Returns the item source
88      *
89      * @return the item source
90      */

91     public Source getSource() {
92         return source;
93     }
94     
95     /**
96      * Sets the item source
97      *
98      * @param source the source
99      *
100      */

101     public void setSource(Source source) {
102         this.source = source;
103     }
104     
105     /**
106      * Returns the item meta element
107      *
108      * @return the item meta element
109      */

110     public Meta getMeta() {
111         return meta;
112     }
113     
114     /**
115      * Sets the meta item
116      *
117      * @param meta the item meta element
118      *
119      */

120     public void setMeta(Meta meta) {
121         this.meta = meta;
122     }
123
124     /**
125      * Returns the item data
126      *
127      * @return the item data
128      *
129      */

130     public ComplexData getData() {
131         return data;
132     }
133     
134     /**
135      * Sets the item data
136      *
137      * @param data the item data
138      *
139      */

140     public void setData(ComplexData data) {
141         this.data = data;
142     }
143     
144     /**
145      * Gets moreData property
146      *
147      * @return true if the data item is incomplete and has further chunks
148      * to come, false otherwise
149      */

150     public boolean isMoreData() {
151         return (moreData != null);
152     }
153
154     /**
155      * Gets the Boolean value of moreData
156      *
157      * @return true if the data item is incomplete and has further chunks
158      * to come, false otherwise
159      */

160     public Boolean JavaDoc getMoreData() {
161         if (!moreData.booleanValue()) {
162             return null;
163         }
164         return moreData;
165     }
166
167     /**
168      * Sets the moreData property
169      *
170      * @param moreData the moreData property
171      */

172     public void setMoreData(Boolean JavaDoc moreData) {
173         this.moreData = (moreData.booleanValue()) ? moreData : null;
174     }
175 }
Popular Tags