DependProfileModule.java

00001 /*
00002  * OpenMobileIS - a free Java(TM) Framework for mobile applications Java(TM)
00003  * Copyright (C) 2004-2006 Philippe Delrieu
00004  * All rights reserved.
00005  * Contact: pdelrieu@openmobileis.org
00006  *
00007  * This library is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2.1 of the License, or any later version.
00011  *
00012  * This library is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with this library; if not, write to the Free Software
00019  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
00020  * USA
00021  *
00022  *  Author : Philippe Delrieu
00023  * 
00024  */
00025 package org.openmobileis.module.core;
00026 
00027 import org.openmobileis.common.util.OpenMISSerializable;
00028 
00036 public final class DependProfileModule implements OpenMISSerializable {
00037   static final long serialVersionUID = 5521257935120563452L;
00038   private String moduleName;
00039   private String moduleVersion;
00040 
00044   public DependProfileModule() {
00045     super();
00046   }
00047   
00048   public DependProfileModule(String name, String version) {
00049     this();
00050     this.moduleName = name;
00051     this.moduleVersion = version;
00052   }
00053 
00054   public String getModuleName() {
00055     return moduleName;
00056   }
00057 
00058   public void setModuleName(String moduleName) {
00059     this.moduleName = moduleName;
00060   }
00061 
00062   public String getModuleVersion() {
00063     return moduleVersion;
00064   }
00065 
00066   public void setModuleVersion(String moduleVersion) {
00067     this.moduleVersion = moduleVersion;
00068   }
00069   
00070   public boolean equals(Object obj) {
00071     if (obj instanceof DependProfileModule) {
00072       DependProfileModule nobj = (DependProfileModule) obj;
00073       if (nobj.getModuleName().equals(this.getModuleName()))    {
00074         if (nobj.getModuleVersion() != null && this.getModuleVersion() == null) {
00075           return false;
00076         } else  if (nobj.getModuleVersion() == null && this.getModuleVersion() != null)  {
00077           return false;
00078         } else if (nobj.getModuleVersion() != null && this.getModuleVersion() != null) {
00079           if (!nobj.getModuleVersion().equals(this.getModuleVersion()))  {
00080             return false;
00081           }
00082         }
00083         return true;
00084       }
00085     }
00086     return false;
00087   }
00088   
00089   public int hashCode() {
00090     String ret = this.getModuleName();
00091     if (this.getModuleVersion() != null){
00092       ret+=this.getModuleVersion();
00093     }
00094     return ret.hashCode();
00095   }
00096 
00097 }

Generated on Mon Dec 4 11:03:25 2006 for OpenMobileIS by  doxygen 1.5.1-p1