/*
 * Generated by XDoclet - Do not edit!
 */
package test.ejb.cmr;

/**
 * Value object for EmployeeAddress.
 *
 * @xdoclet-generated at 22-10-04
 * @copyright The XDoclet Team
 * @author XDoclet
 * @version 1.2.2
 */
public class EmployeeAddressValue
   extends java.lang.Object
   implements java.io.Serializable 
{
   private java.lang.Integer id;
   private boolean idHasBeenSet = false;
   private java.lang.String description;
   private boolean descriptionHasBeenSet = false;

   private java.lang.Integer pk;

   public EmployeeAddressValue()
   {
   }

   public EmployeeAddressValue( java.lang.Integer id,java.lang.String description )
   {
	  this.id = id;
	  idHasBeenSet = true;
	  this.description = description;
	  descriptionHasBeenSet = true;
	  pk = this.getId();
   }

   //TODO Cloneable is better than this !
   public EmployeeAddressValue( EmployeeAddressValue otherValue )
   {
	  this.id = otherValue.id;
	  idHasBeenSet = true;
	  this.description = otherValue.description;
	  descriptionHasBeenSet = true;

	  pk = this.getId();
   }

   public java.lang.Integer getPrimaryKey()
   {
	  return pk;
   }

   public void setPrimaryKey( java.lang.Integer pk )
   {
      // it's also nice to update PK object - just in case
      // somebody would ask for it later...
      this.pk = pk;
	  setId( pk );
   }

   public java.lang.Integer getId()
   {
	  return this.id;
   }

   public void setId( java.lang.Integer id )
   {
	  this.id = id;
	  idHasBeenSet = true;

		  pk = id;
   }

   public boolean idHasBeenSet(){
	  return idHasBeenSet;
   }
   public java.lang.String getDescription()
   {
	  return this.description;
   }

   public void setDescription( java.lang.String description )
   {
	  this.description = description;
	  descriptionHasBeenSet = true;

   }

   public boolean descriptionHasBeenSet(){
	  return descriptionHasBeenSet;
   }

   public String toString()
   {
	  StringBuffer str = new StringBuffer("{");

	  str.append("id=" + getId() + " " + "description=" + getDescription());
	  str.append('}');

	  return(str.toString());
   }

   /**
    * A Value Object has an identity if the attributes making its Primary Key have all been set. An object without identity is never equal to any other object.
    *
    * @return true if this instance has an identity.
    */
   protected boolean hasIdentity()
   {
	  return idHasBeenSet;
   }

   public boolean equals(Object other)
   {
      if (this == other)
         return true;
	  if ( ! hasIdentity() ) return false;
	  if (other instanceof EmployeeAddressValue)
	  {
		 EmployeeAddressValue that = (EmployeeAddressValue) other;
		 if ( ! that.hasIdentity() ) return false;
		 boolean lEquals = true;

		 lEquals = lEquals && isIdentical(that);

		 return lEquals;
	  }
	  else
	  {
		 return false;
	  }
   }

   public boolean isIdentical(Object other)
   {
	  if (other instanceof EmployeeAddressValue)
	  {
		 EmployeeAddressValue that = (EmployeeAddressValue) other;
		 boolean lEquals = true;
		 if( this.id == null )
		 {
			lEquals = lEquals && ( that.id == null );
		 }
		 else
		 {
			lEquals = lEquals && this.id.equals( that.id );
		 }
		 if( this.description == null )
		 {
			lEquals = lEquals && ( that.description == null );
		 }
		 else
		 {
			lEquals = lEquals && this.description.equals( that.description );
		 }

		 return lEquals;
	  }
	  else
	  {
		 return false;
	  }
   }

   public int hashCode(){
	  int result = 17;
      result = 37*result + ((this.id != null) ? this.id.hashCode() : 0);

      result = 37*result + ((this.description != null) ? this.description.hashCode() : 0);

	  return result;
   }

}
