/**
* Copyright 1999-2001 by Nordija <www.nordija.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**/
package com.nordija.portal.entity;
import com.nordija.midtier.ejb.EjbUtil;
import com.nordija.midtier.ejb.PkHashCode;
import java.io.Serializable;
/**
* This defines the primary key for the Choice bean
*
* Generated by Nordija BeanBuilder - www.nordija.com
*
* @author Nordija ApS
*/
public class ChoicePK implements Serializable
{
/** The unique id of the choice */
public long choiceId;
/**
* Constructor without parameters - required for serialization
*/
public ChoicePK()
{
}
/**
* Constructor with parameters
*
* @param choiceId The unique id of the choice
*/
public ChoicePK(long choiceId)
{
this.choiceId = choiceId;
}
/**
* Compares two Primary Keys for equality (overriding method in Object).
* See section 9.2.9 in EJB spec 1.1
*
* @param otherPk the reference object with which to compare (expected to be a AfregningPK)
* @return true if this object is the same as the obj argument; false otherwise
*/
public boolean equals(Object otherPk)
{
return otherPk instanceof ChoicePK &&
EjbUtil.testEquals(choiceId, ((ChoicePK)otherPk).choiceId);
}
/**
* Returns a hash code value for the object (overriding method in Object).
* See section 9.2.9 in EJB spec 1.1 and www.ejbnow.com/ejbtips/ejbtip_1.html
* Thanks to Richard Monson-Haefel
*
* @return a hash code value for this object
*/
public int hashCode()
{
PkHashCode hc = new PkHashCode();
hc.add(choiceId);
return hc.getPkHashCode();
}
/**
* Provide a string representation of this PK. Typically useful in order to
* create more meaningful exception messages.
*
* @return String representation of object
*/
public String toString()
{
StringBuffer s = new StringBuffer(100);
s.append("ChoicePK: ");
s.append(choiceId);
return s.toString();
}
}