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

com.github.gentity.demoaddressbook2.Entry Maven / Gradle / Ivy

There is a newer version: 1.0.0
Show newest version

package com.github.gentity.demoaddressbook2;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.CollectionTable;
import javax.persistence.Column;
import javax.persistence.ElementCollection;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Table;

@Entity
@Table(name = "ENTRY")
public class Entry implements Serializable
{

    @ElementCollection
    @CollectionTable(name = "PHONE_NUMBER", joinColumns = {
        @JoinColumn(name = "ENTRY_ID", referencedColumnName = "ID")
    })
    protected List phoneNumber = new ArrayList();
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "ID")
    protected Integer id;
    @Column(name = "FIRST_NAME", length = 100, nullable = false)
    protected String firstName;
    @Column(name = "LAST_NAME", length = 100)
    protected String lastName;
    @Column(name = "STREET", length = 100)
    protected String street;
    @Column(name = "CITY", length = 50)
    protected String city;

    public static Entry.Builder builder() {
        return new Entry.Builder();
    }

    public List getPhoneNumber() {
        return phoneNumber;
    }

    public void setPhoneNumber(List phoneNumber) {
        this.phoneNumber = phoneNumber;
    }

    public Integer getId() {
        return id;
    }

    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    public String getStreet() {
        return street;
    }

    public void setStreet(String street) {
        this.street = street;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public static class Builder {

        private final Entry instance = new Entry();

        public Entry build() {
            return instance;
        }

        public Entry.Builder phoneNumber(List phoneNumber) {
            instance.phoneNumber = phoneNumber;
            return this;
        }

        public Entry.Builder firstName(String firstName) {
            instance.firstName = firstName;
            return this;
        }

        public Entry.Builder lastName(String lastName) {
            instance.lastName = lastName;
            return this;
        }

        public Entry.Builder street(String street) {
            instance.street = street;
            return this;
        }

        public Entry.Builder city(String city) {
            instance.city = city;
            return this;
        }

    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy