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

/**
 * Value object for Customer.
 *
 * @xdoclet-generated at 22-10-04
 * @copyright The XDoclet Team
 * @author XDoclet
 * @version 1.2.2
 */
public class CustomerLightValue
   extends java.lang.Object
   implements java.io.Serializable 
{
   private float credit;
   private boolean creditHasBeenSet = false;
   private java.lang.String[][] array;
   private boolean arrayHasBeenSet = false;
   private byte[] image;
   private boolean imageHasBeenSet = false;
   private java.lang.String id;
   private boolean idHasBeenSet = false;

   private test.interfaces.CustomerPK pk;

   private int _version = 0;

   public CustomerLightValue()
   {
	  pk = new test.interfaces.CustomerPK();
   }

   public CustomerLightValue( float credit,java.lang.String[][] array,byte[] image,java.lang.String id )
   {
	  this.credit = credit;
	  creditHasBeenSet = true;
	  this.array = array;
	  arrayHasBeenSet = true;
	  this.image = image;
	  imageHasBeenSet = true;
	  this.id = id;
	  idHasBeenSet = true;
	  pk = new test.interfaces.CustomerPK(this.getId());
   }

   //TODO Cloneable is better than this !
   public CustomerLightValue( CustomerLightValue otherValue )
   {
	  this.credit = otherValue.credit;
	  creditHasBeenSet = true;
	  this.array = otherValue.array;
	  arrayHasBeenSet = true;
	  this.image = otherValue.image;
	  imageHasBeenSet = true;
	  this.id = otherValue.id;
	  idHasBeenSet = true;

	  pk = new test.interfaces.CustomerPK(this.getId());
   }

   public test.interfaces.CustomerPK getPrimaryKey()
   {
	  return pk;
   }

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

   public float getCredit()
   {
	  return this.credit;
   }

   public void setCredit( float credit )
   {
	  this.credit = credit;
	  creditHasBeenSet = true;

   }

   public boolean creditHasBeenSet(){
	  return creditHasBeenSet;
   }
   public java.lang.String[][] getArray()
   {
	  return this.array;
   }

   public byte[] getImage()
   {
	  return this.image;
   }

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

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

		 pk.setId(id);
   }

   public boolean idHasBeenSet(){
	  return idHasBeenSet;
   }

   public int getVersion()
   {
	  return _version;
   }
   public void setVersion(int version)
   {
	  this._version = version;
   }

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

	  str.append("credit=" + getCredit() + " " + "array=" + getArray() + " " + "image=" + getImage() + " " + "id=" + getId());
	  str.append(",version=");
	  str.append(_version);
	  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()
   {
	  boolean ret = true;
	  ret = ret && idHasBeenSet;
	  return ret;
   }

   public boolean equals(Object other)
   {
      if (this == other)
         return true;
	  if ( ! hasIdentity() ) return false;
	  if (other instanceof CustomerLightValue)
	  {
		 CustomerLightValue that = (CustomerLightValue) other;
		 if ( ! that.hasIdentity() ) return false;
		 boolean lEquals = true;
		 if( this.id == null )
		 {
			lEquals = lEquals && ( that.id == null );
		 }
		 else
		 {
			lEquals = lEquals && this.id.equals( that.id );
		 }

		 lEquals = lEquals && isIdentical(that);

		 return lEquals;
	  }
	  else
	  {
		 return false;
	  }
   }

   public boolean isIdentical(Object other)
   {
	  if (other instanceof CustomerLightValue)
	  {
		 CustomerLightValue that = (CustomerLightValue) other;
		 boolean lEquals = true;
		 lEquals = lEquals && this.credit == that.credit;
		 if( this.array == null )
		 {
			lEquals = lEquals && ( that.array == null );
		 }
		 else
		 {
			lEquals = lEquals && this.array.equals( that.array );
		 }
		 lEquals = lEquals && this.image == that.image;

		 return lEquals;
	  }
	  else
	  {
		 return false;
	  }
   }

   public int hashCode(){
	  int result = 17;
      result = 37*result + Float.floatToIntBits(credit);

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

      if (image != null) {
        for (int i=0; i<image.length; i++)
        {
          long l = image[i];
          result = 37*result + (int)(l^(l>>>32));
        }
      }

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

	  return result;
   }

}
