de.weltraumschaf.maconha.server.model.Song.java Source code

Java tutorial

Introduction

Here is the source code for de.weltraumschaf.maconha.server.model.Song.java

Source

/*
 *  LICENSE
 *
 * "THE BEER-WARE LICENSE" (Revision 43):
 * "Sven Strittmatter" <weltraumschaf@googlemail.com> wrote this file.
 * As long as you retain this notice you can do whatever you want with
 * this stuff. If we meet some day, and you think this stuff is worth it,
 * you can buy me a non alcohol-free beer in return.
 *
 * Copyright (C) 2012 "Sven Strittmatter" <weltraumschaf@googlemail.com>
 */
package de.weltraumschaf.maconha.server.model;

import java.io.Serializable;
import java.lang.reflect.InvocationTargetException;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import org.apache.commons.beanutils.BeanUtils;

/**
 *
 * @author Sven Strittmatter <weltraumschaf@googlemail.com>
 */
//@SuppressWarnings("restriction")
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public final class Song implements Serializable {

    private static final long serialVersionUID = 1L;

    @XmlElement(name = "id")
    private Long id;

    @XmlElement(name = "title")
    private String title;

    @XmlElement(name = "comment")
    private String comment;

    @XmlElement(name = "genre")
    private int genre;

    @XmlElement(name = "track")
    private int track;

    @XmlElement(name = "year")
    private int year;

    public Song(final SongEntity songById) {
        super();

        try {
            BeanUtils.copyProperties(this, songById);
        } catch (final IllegalAccessException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (final InvocationTargetException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

    public Long getId() {
        return id;
    }

    public void setId(final Long id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(final String title) {
        this.title = title;
    }

    public String getComment() {
        return comment;
    }

    public void setComment(final String comment) {
        this.comment = comment;
    }

    public int getGenre() {
        return genre;
    }

    public void setGenre(final int genre) {
        this.genre = genre;
    }

    public int getTrack() {
        return track;
    }

    public void setTrack(final int track) {
        this.track = track;
    }

    public int getYear() {
        return year;
    }

    public void setYear(final int year) {
        this.year = year;
    }

}