intec.sli.iwstudy.teamcalendar.domain.model.Event.java Source code

Java tutorial

Introduction

Here is the source code for intec.sli.iwstudy.teamcalendar.domain.model.Event.java

Source

/*
 * Copyright (C) 2014 Yusuke Ikeda <yukung.i@gmail.com>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package intec.sli.iwstudy.teamcalendar.domain.model;

import java.util.Date;

import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;

/**
 * Event ??
 * 
 * @author yukung
 *
 */
public class Event {

    /** Event ? ID */
    private Integer id;

    /** Event ? */
    private Date from;

    /** Event ? */
    private Date to;

    /** Event ? */
    private String text;

    /**
     * Event ? ID ????
     * 
     * @return ID
     */
    public Integer getId() {
        return id;
    }

    /**
     * Event ? ID ???
     * 
     * @param id ID
     */
    public void setId(Integer id) {
        this.id = id;
    }

    /**
     * Event ?????
     * 
     * @return 
     */
    public Date getFrom() {
        return from;
    }

    /**
     * Event ????
     * 
     * @param from 
     */
    public void setFrom(Date from) {
        this.from = from;
    }

    /**
     * Event ?????
     * 
     * @return 
     */
    public Date getTo() {
        return to;
    }

    /**
     * Event ????
     * 
     * @param to 
     */
    public void setTo(Date to) {
        this.to = to;
    }

    /**
     * Event ?????
     * 
     * @return 
     */
    public String getText() {
        return text;
    }

    /**
     * Event ????
     * 
     * @param text 
     */
    public void setText(String text) {
        this.text = text;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this).append(id).append(text).append(from).append(to).toString();
    }

    @Override
    public int hashCode() {
        return new HashCodeBuilder().append(id).append(from).append(to).append(text).toHashCode();
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        Event other = (Event) obj;
        return new EqualsBuilder().append(this.id, other.id).append(this.from, other.from).append(this.to, other.to)
                .append(this.text, other.text).isEquals();
    }

}