/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.actiwaves.swing.TestSwing;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 *
 * @author sudeep.panchal
 */
@Entity
@Table(name = "addresstypes")
@NamedQueries( {@NamedQuery(name = "Addresstypes.findByAddressType",query = "SELECT a FROM Addresstypes a WHERE a.addressType = :addressType"),@NamedQuery(name = "Addresstypes.findByDescription",query = "SELECT a FROM Addresstypes a WHERE a.description = :description")})
public class Addresstypes implements Serializable {
    @Transient
    private
    PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final
    long serialVersionUID = 1L;
    @Id
    @Column(name = "AddressType",nullable = false)
    private
    Short addressType;
    @Column(name = "Description",nullable = false)
    private
    String description;

    public
    Addresstypes()
    {
    }

    public
    Addresstypes(Short addressType)
    {
        this.addressType = addressType;
    }

    public
    Addresstypes(Short addressType,String description)
    {
        this.addressType = addressType;
        this.description = description;
    }

    public
    Short getAddressType()
    {
        return addressType;
    }

    public
    void setAddressType(Short addressType)
    {
        Short oldAddressType = this.addressType;
        this.addressType = addressType;
        changeSupport.firePropertyChange("addressType",oldAddressType,addressType);
    }

    public
    String getDescription()
    {
        return description;
    }

    public
    void setDescription(String description)
    {
        String oldDescription = this.description;
        this.description = description;
        changeSupport.firePropertyChange("description",oldDescription,description);
    }

    @Override
    public
    int hashCode()
    {
        int hash = 0;
        hash += (addressType != null ? addressType.hashCode() : 0);
        return hash;
    }

    @Override
    public
    boolean equals(Object object)
    {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if(!(object instanceof Addresstypes))
        {
            return false;
        }
        Addresstypes other = (Addresstypes)object;
        if((this.addressType == null && other.addressType != null) || (this.addressType != null && !this.addressType.equals(other.addressType)))
        {
            return false;
        }
        return true;
    }

    @Override
    public
    String toString()
    {
        return "com.actiwaves.swing.TestSwing.Addresstypes[addressType=" + addressType + "]";
    }

    public
    void addPropertyChangeListener(PropertyChangeListener listener)
    {
        changeSupport.addPropertyChangeListener(listener);
    }

    public
    void removePropertyChangeListener(PropertyChangeListener listener)
    {
        changeSupport.addPropertyChangeListener(listener);
    }

}
