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

/**
 * Value object for Account.
 *
 * @xdoclet-generated at 22-10-04
 * @copyright The XDoclet Team
 * @author XDoclet
 * @version 1.2.2
 */
public class AccountValue
   extends java.lang.Object
   implements java.io.Serializable 
{
   private java.lang.Integer id;
   private boolean idHasBeenSet = false;
   private float totalBalance;
   private boolean totalBalanceHasBeenSet = false;
   private float balance;
   private boolean balanceHasBeenSet = false;
   private java.lang.String accountId;
   private boolean accountIdHasBeenSet = false;
   private test.interfaces.CustomerNormalValue OwnerNormalValue;
   private boolean OwnerNormalValueHasBeenSet = false;

   private test.interfaces.AccountPK pk;

   public AccountValue()
   {
	  pk = new test.interfaces.AccountPK();
   }

   public AccountValue( java.lang.Integer id,float totalBalance,float balance,java.lang.String accountId )
   {
	  this.id = id;
	  idHasBeenSet = true;
	  this.totalBalance = totalBalance;
	  totalBalanceHasBeenSet = true;
	  this.balance = balance;
	  balanceHasBeenSet = true;
	  this.accountId = accountId;
	  accountIdHasBeenSet = true;
	  pk = new test.interfaces.AccountPK(this.getId());
   }

   //TODO Cloneable is better than this !
   public AccountValue( AccountValue otherValue )
   {
	  this.id = otherValue.id;
	  idHasBeenSet = true;
	  this.totalBalance = otherValue.totalBalance;
	  totalBalanceHasBeenSet = true;
	  this.balance = otherValue.balance;
	  balanceHasBeenSet = true;
	  this.accountId = otherValue.accountId;
	  accountIdHasBeenSet = true;
	// TODO Clone is better no ?
	  this.OwnerNormalValue = otherValue.OwnerNormalValue;
	  OwnerNormalValueHasBeenSet = true;

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

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

   public void setPrimaryKey( test.interfaces.AccountPK 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 java.lang.Integer getId()
   {
	  return this.id;
   }

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

		 pk.setId(id);
   }

   public boolean idHasBeenSet(){
	  return idHasBeenSet;
   }
   public float getTotalBalance()
   {
	  return this.totalBalance;
   }

   public float getBalance()
   {
	  return this.balance;
   }

   public void setBalance( float balance )
   {
	  this.balance = balance;
	  balanceHasBeenSet = true;

   }

   public boolean balanceHasBeenSet(){
	  return balanceHasBeenSet;
   }
   public java.lang.String getAccountId()
   {
	  return this.accountId;
   }

   public test.interfaces.CustomerNormalValue getOwnerNormalValue()
   {
	  return this.OwnerNormalValue;
   }
   public void setOwnerNormalValue( test.interfaces.CustomerNormalValue OwnerNormalValue )
   {
	  this.OwnerNormalValue = OwnerNormalValue;
	  OwnerNormalValueHasBeenSet = true;
   }

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

	  str.append("id=" + getId() + " " + "totalBalance=" + getTotalBalance() + " " + "balance=" + getBalance() + " " + "accountId=" + getAccountId());
	  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 AccountValue)
	  {
		 AccountValue that = (AccountValue) 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 AccountValue)
	  {
		 AccountValue that = (AccountValue) other;
		 boolean lEquals = true;
		 lEquals = lEquals && this.totalBalance == that.totalBalance;
		 lEquals = lEquals && this.balance == that.balance;
		 if( this.accountId == null )
		 {
			lEquals = lEquals && ( that.accountId == null );
		 }
		 else
		 {
			lEquals = lEquals && this.accountId.equals( that.accountId );
		 }
		 if( this.OwnerNormalValue == null )
		 {
			lEquals = lEquals && ( that.OwnerNormalValue == null );
		 }
		 else
		 {
			lEquals = lEquals && this.OwnerNormalValue.equals( that.OwnerNormalValue );
		 }

		 return lEquals;
	  }
	  else
	  {
		 return false;
	  }
   }

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

      result = 37*result + Float.floatToIntBits(totalBalance);

      result = 37*result + Float.floatToIntBits(balance);

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

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

}
