All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.greenpepper.samples.application.phonebook.PhoneBookEntry Maven / Gradle / Ivy

There is a newer version: 4.2.4
Show newest version
package com.greenpepper.samples.application.phonebook;

import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
/**
 * 

PhoneBookEntry class.

* * @author oaouattara * @version $Id: $Id */ @Table(name="PHONEBOOK_ENTRY") @SuppressWarnings("serial") public class PhoneBookEntry extends AbstractEntity { private PhoneBook phoneBook; private String firstName; private String lastName; private String number; /** *

Constructor for PhoneBookEntry.

* * @param phoneBook a {@link com.greenpepper.samples.application.phonebook.PhoneBook} object. * @param firstName a {@link java.lang.String} object. * @param lastName a {@link java.lang.String} object. * @param number a {@link java.lang.String} object. */ public PhoneBookEntry(PhoneBook phoneBook, String firstName, String lastName, String number) { super(); this.phoneBook = phoneBook; this.firstName = firstName; this.lastName = lastName; this.number = number; } /** *

Getter for the field firstName.

* * @return a {@link java.lang.String} object. */ @Basic @Column(name = "FIRSTNAME", unique = true, nullable = false, length=255) public String getFirstName() { return firstName; } /** *

Getter for the field lastName.

* * @return a {@link java.lang.String} object. */ @Basic @Column(name = "LASTNAME", unique = true, nullable = false, length=255) public String getLastName() { return lastName; } /** *

Getter for the field number.

* * @return a {@link java.lang.String} object. */ @Basic @Column(name = "NUMBER", unique = true, nullable = false, length=255) public String getNumber() { return number; } /** *

Getter for the field phoneBook.

* * @return a {@link com.greenpepper.samples.application.phonebook.PhoneBook} object. */ @ManyToOne( cascade = {CascadeType.PERSIST, CascadeType.MERGE} ) @JoinColumn(name="PHONEBOOK_ID") public PhoneBook getPhoneBook() { return phoneBook; } /** *

Setter for the field firstName.

* * @param firstName a {@link java.lang.String} object. */ public void setFirstName(String firstName) { this.firstName = firstName; } /** *

Setter for the field lastName.

* * @param lastName a {@link java.lang.String} object. */ public void setLastName(String lastName) { this.lastName = lastName; } /** *

Setter for the field number.

* * @param number a {@link java.lang.String} object. */ public void setNumber(String number) { this.number = number; } /** *

Setter for the field phoneBook.

* * @param phoneBook a {@link com.greenpepper.samples.application.phonebook.PhoneBook} object. */ public void setPhoneBook(PhoneBook phoneBook) { this.phoneBook = phoneBook; } /** {@inheritDoc} */ public boolean equals(Object o) { if(!(o instanceof PhoneBookEntry)) { return false; } PhoneBookEntry entryCompared = (PhoneBookEntry)o; if(getFirstName().equals(entryCompared.getFirstName()) && getLastName().equals(entryCompared.getLastName()) && getNumber().equals(entryCompared.getNumber()) && getPhoneBook().equals(entryCompared.getPhoneBook())) { return true; } return false; } /** *

hashCode.

* * @return a int. */ public int hashCode() { return getFirstName().hashCode() + getLastName().hashCode() + getNumber().hashCode() + getPhoneBook().hashCode(); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy