001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041:
042: package movieslib;
043:
044: import java.io.Serializable;
045:
046: public class Movie implements Serializable {
047:
048: private static int nextId = 1;
049:
050: /**
051: * Creates a new instance of Movie.
052: */
053: public Movie() {
054: synchronized (Movie.class) {
055: this .id = new Integer(nextId);
056: nextId++;
057: }
058: }
059:
060: /**
061: * Holds value of property title.
062: */
063: private String title;
064:
065: /**
066: * Getter for property title.
067: * @return Value of property title.
068: */
069: public String getTitle() {
070: return this .title;
071: }
072:
073: /**
074: * Setter for property title.
075: * @param title New value of property title.
076: */
077: public void setTitle(String title) {
078: this .title = title;
079: }
080:
081: /**
082: * Holds value of property year.
083: */
084: private Integer year;
085:
086: /**
087: * Getter for property year.
088: * @return Value of property year.
089: */
090: public Integer getYear() {
091: return this .year;
092: }
093:
094: /**
095: * Setter for property year.
096: * @param year New value of property year.
097: */
098: public void setYear(Integer year) {
099: this .year = year;
100: }
101:
102: /**
103: * Holds value of property length.
104: */
105: private Integer length;
106:
107: /**
108: * Getter for property length.
109: * @return Value of property length.
110: */
111: public Integer getLength() {
112: return this .length;
113: }
114:
115: /**
116: * Setter for property length.
117: * @param length New value of property length.
118: */
119: public void setLength(Integer length) {
120: this .length = length;
121: }
122:
123: /**
124: * Holds value of property rating.
125: */
126: private String rating;
127:
128: /**
129: * Getter for property rating.
130: * @return Value of property rating.
131: */
132: public String getRating() {
133: return this .rating;
134: }
135:
136: /**
137: * Setter for property rating.
138: * @param rating New value of property rating.
139: */
140: public void setRating(String rating) {
141: this .rating = rating;
142: }
143:
144: /**
145: * Holds value of property description.
146: */
147: private String description;
148:
149: /**
150: * Getter for property description.
151: * @return Value of property description.
152: */
153: public String getDescription() {
154: return this .description;
155: }
156:
157: /**
158: * Setter for property description.
159: * @param description New value of property description.
160: */
161: public void setDescription(String description) {
162: this .description = description;
163: }
164:
165: /**
166: * Holds value of property image.
167: */
168: private String image;
169:
170: /**
171: * Getter for property image.
172: * @return Value of property image.
173: */
174: public String getImage() {
175: return this .image;
176: }
177:
178: /**
179: * Setter for property image.
180: * @param image New value of property image.
181: */
182: public void setImage(String image) {
183: this .image = image;
184: }
185:
186: /**
187: * Holds value of property id.
188: */
189: private Integer id;
190:
191: /**
192: * Getter for property id.
193: * @return Value of property id.
194: */
195: public Integer getId() {
196: return this .id;
197: }
198:
199: /**
200: * Holds value of property genre.
201: */
202: private String genre;
203:
204: /**
205: * Getter for property genre.
206: * @return Value of property genre.
207: */
208: public String getGenre() {
209: return this .genre;
210: }
211:
212: /**
213: * Setter for property genre.
214: * @param genre New value of property genre.
215: */
216: public void setGenre(String genre) {
217:
218: this .genre = genre;
219: }
220:
221: public String toString() {
222: StringBuffer sb = new StringBuffer("<movie>");
223: sb.append("id=");
224: sb.append(id);
225: sb.append(", title=");
226: sb.append(title);
227: sb.append(", year=");
228: sb.append(year);
229: sb.append(", genre=");
230: sb.append(genre);
231: sb.append(", length=");
232: sb.append(length);
233: sb.append(", rating=");
234: sb.append(rating);
235: sb.append(", image=");
236: sb.append(image);
237: sb.append(", description=");
238: sb.append(description);
239: sb.append("</movie>");
240: return sb.toString();
241: }
242: }
|