Java tutorial
/* **************************************************************************** * * * (c) Copyright 2006 ABM-utvikling * * * * 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. http://www.gnu.org/licenses/gpl.html * * * **************************************************************************** */ package no.abmu.finances.domain; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * BoolPostData. * * @author Erik Romson, erik@zenior.no * @author $Author: jens $ * @version $Rev: 12852 $ * @date $Date: 2009-01-30 22:10:45 +0100 (Fri, 30 Jan 2009) $ * @copyright ABM-Utvikling * * @hibernate.joined-subclass table="FINANCE_BOOL_POST_DATA" * @hibernate.joined-subclass-key column="id" * @ hibernate.cache usage="nonstrict-read-write" */ public class BoolPostData extends PostData { private static final Log logger = (Log) LogFactory.getLog(BoolPostData.class); private Boolean boolValue; public BoolPostData() { } public BoolPostData(BoolPost post) { super(post); } /** * getId. * * @return * @ hibernate.id generator-class="increment" */ public Long getId() { return super.getId(); } public Object getUntypedValue() { return getValue(); } public Boolean getValue() { return boolValue; } public void setValue(Boolean value) { if ((boolValue == value) || ((boolValue != null) && boolValue.equals(value))) { return; } boolValue = value; setDirty(); } public void setValueAsString(String value) { setValue(Boolean.valueOf(Boolean.getBoolean(value))); } public boolean acceptValue(Object value) { return (value instanceof Boolean); } /** * getBoolValue. * * @hibernate.property */ public Boolean getBoolValue() { return boolValue; } public void setBoolValue(Boolean boolValue) { setValue(boolValue); } public String toString() { return boolValue != null ? boolValue.toString() : ""; } public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final BoolPostData boolPostData = (BoolPostData) obj; if (getBoolValue() != null ? !getBoolValue().equals(boolPostData.getBoolValue()) : boolPostData.getBoolValue() != null) { return false; } return true; } public int hashCode() { return (getBoolValue() != null ? getBoolValue().hashCode() : 0); } }