Wednesday, November 7, 2007

J2EE - Vinyl Object

// -----------------------------------------------------------------------------
package myVinylCollection;
// -----------------------------------------------------------------------------
import java.util.*;
import java.io.*;
import java.net.*;
import javax.servlet.*;
import javax.servlet.http.*;
// -----------------------------------------------------------------------------
/**
* A Vinyl record. Individual tracks are not represented.

*/

public class Vinyl implements java.io.Serializable {
private String title, artist, genre, year, duration;
private int id;
/**
* Creates a new Vinyl object, with the given values.
*@param title the Vinyl title
*@param artist the artist/creator of the Vinyl content
*@param genre a categorization of the content
*@param year the year the content was first published
*@param duration the total duration of the recording
*/
public Vinyl (int id, String title, String artist, String genre, String year, String duration) {
this.id = id; this.title = title; this.artist = artist; this.genre = genre; this.year = year; this.duration = duration;
}
/**
* Creates a new, uninitialized Vinyl object.
*/
public Vinyl () {
title = artist = genre = year = duration = "UNDEFINED";
id = -1;
}

// JavaBean interface
// defines RW properties: title, artist, genre, year, duration
public String getTitle () { return title; }
public void setTitle (String newTitle) { title = newTitle; }

public String getArtist () { return artist; }
public void setArtist (String newArtist) { artist = newArtist; }

public String getGenre () { return genre; }
public void setGenre (String newGenre) { genre = newGenre; }

public String getYear () { return year; }
public void setYear (String newYear) { year = newYear; }

public String getDuration () { return duration; }
public void setDuration (String newDuration) { duration = newDuration; }

public int getID () { return id; }
public void setID (int newID) { id = newID; }

}

No comments: