/*
 * 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 = "addressformat")
@NamedQueries( {@NamedQuery(name = "Addressformat.findByAddressFormatType",query = "SELECT a FROM Addressformat a WHERE a.addressFormatType = :addressFormatType"),@NamedQuery(name = "Addressformat.findByDescription",query = "SELECT a FROM Addressformat a WHERE a.description = :description")})
public class Addressformat implements Serializable {
    @Transient
    private
    PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final
    long serialVersionUID = 1L;
    @Id
    @Column(name = "AddressFormatType",nullable = false)
    private
    Short addressFormatType;
    @Column(name = "Description",nullable = false)
    private
    String description;

    public
    Addressformat()
    {
    }

    public
    Addressformat(Short addressFormatType)
    {
        this.addressFormatType = addressFormatType;
    }

    public
    Addressformat(Short addressFormatType,String description)
    {
        this.addressFormatType = addressFormatType;
        this.description = description;
    }

    public
    Short getAddressFormatType()
    {
        return addressFormatType;
    }

    public
    void setAddressFormatType(Short addressFormatType)
    {
        Short oldAddressFormatType = this.addressFormatType;
        this.addressFormatType = addressFormatType;
        changeSupport.firePropertyChange("addressFormatType",oldAddressFormatType,addressFormatType);
    }

    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 += (addressFormatType != null ? addressFormatType.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 Addressformat))
        {
            return false;
        }
        Addressformat other = (Addressformat)object;
        if((this.addressFormatType == null && other.addressFormatType != null) || (this.addressFormatType != null && !this.addressFormatType.equals(other.addressFormatType)))
        {
            return false;
        }
        return true;
    }

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

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

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

}
