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

import java.util.*;

/**
 * Value object for TestEntity.
 *
 */
public class TestEntityValue
   extends  
java.lang.Object 
   implements java.io.Serializable 
{
   private java.lang.String entityID;
   private boolean entityIDHasBeenSet = false;
   private java.lang.String value1;
   private boolean value1HasBeenSet = false;

   private java.lang.String pk;

   public TestEntityValue()
   {
   }

   public TestEntityValue( java.lang.String entityID,java.lang.String value1 )
   {
	  this.entityID = entityID;
	  entityIDHasBeenSet = true;
	  this.value1 = value1;
	  value1HasBeenSet = true;
	  pk = this.getEntityID();
   }

   //TODO Cloneable is better than this !
   public TestEntityValue( TestEntityValue otherValue )
   {
	  this.entityID = otherValue.entityID;
	  entityIDHasBeenSet = true;
	  this.value1 = otherValue.value1;
	  value1HasBeenSet = true;

	  pk = this.getEntityID();
   }

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

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

   public java.lang.String getEntityID()
   {
	  return this.entityID;
   }

   public void setEntityID( java.lang.String entityID )
   {
	  this.entityID = entityID;
	  entityIDHasBeenSet = true;

		  pk = entityID;
   }

   public boolean entityIDHasBeenSet(){
	  return entityIDHasBeenSet;
   }
   public java.lang.String getValue1()
   {
	  return this.value1;
   }

   public void setValue1( java.lang.String value1 )
   {
	  this.value1 = value1;
	  value1HasBeenSet = true;

   }

   public boolean value1HasBeenSet(){
	  return value1HasBeenSet;
   }

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

	  str.append("entityID=" + getEntityID() + " " + "value1=" + getValue1());
	  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 entityIDHasBeenSet;
   }

   public boolean equals(Object other)
   {
      if (this == other)
         return true;
	  if ( ! hasIdentity() ) return false;
	  if (other instanceof TestEntityValue)
	  {
		 TestEntityValue that = (TestEntityValue) 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 TestEntityValue)
	  {
		 TestEntityValue that = (TestEntityValue) other;
		 boolean lEquals = true;
		 if( this.entityID == null )
		 {
			lEquals = lEquals && ( that.entityID == null );
		 }
		 else
		 {
			lEquals = lEquals && this.entityID.equals( that.entityID );
		 }
		 if( this.value1 == null )
		 {
			lEquals = lEquals && ( that.value1 == null );
		 }
		 else
		 {
			lEquals = lEquals && this.value1.equals( that.value1 );
		 }

		 return lEquals;
	  }
	  else
	  {
		 return false;
	  }
   }

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

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

	  return result;
   }

}
