| %line | %branch | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| nl.toolforge.karma.core.vc.AuthenticatorKey |
|
|
| 1 | /* |
|
| 2 | Karma core - Core of the Karma application |
|
| 3 | Copyright (C) 2004 Toolforge <www.toolforge.nl> |
|
| 4 | ||
| 5 | This library is free software; you can redistribute it and/or |
|
| 6 | modify it under the terms of the GNU Lesser General Public |
|
| 7 | License as published by the Free Software Foundation; either |
|
| 8 | version 2.1 of the License, or (at your option) any later version. |
|
| 9 | ||
| 10 | This library is distributed in the hope that it will be useful, |
|
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
| 13 | Lesser General Public License for more details. |
|
| 14 | ||
| 15 | You should have received a copy of the GNU Lesser General Public |
|
| 16 | License along with this library; if not, write to the Free Software |
|
| 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
| 18 | */ |
|
| 19 | package nl.toolforge.karma.core.vc; |
|
| 20 | ||
| 21 | /** |
|
| 22 | * @author D.A. Smedes |
|
| 23 | * @version $Id: AuthenticatorKey.java,v 1.3 2004/10/26 22:58:47 clutjespelberg Exp $ |
|
| 24 | */ |
|
| 25 | public final class AuthenticatorKey { |
|
| 26 | ||
| 27 | 7466 | private String workingContext = null; |
| 28 | 7466 | private String locationId = null; |
| 29 | ||
| 30 | /** |
|
| 31 | * Creates a new authenticator key. References to <code>locations.xml</code>. |
|
| 32 | * @param workingContext The name of the working context. |
|
| 33 | * @param locationId The id of the location. |
|
| 34 | * @throws IllegalArgumentException When the parameters are empty or null. |
|
| 35 | */ |
|
| 36 | 7466 | public AuthenticatorKey(String workingContext, String locationId) { |
| 37 | ||
| 38 | 7466 | if ("".equals(workingContext) || "".equals(locationId) || workingContext == null || locationId == class="keyword">null) { |
| 39 | 0 | throw new IllegalArgumentException("Composite key : workingContext and locationId cannot be null or empty."); |
| 40 | } |
|
| 41 | ||
| 42 | 7466 | this.workingContext = workingContext; |
| 43 | 7466 | this.locationId = locationId; |
| 44 | 7466 | } |
| 45 | ||
| 46 | public int hashCode() { |
|
| 47 | 13112 | return workingContext.hashCode() + locationId.hashCode(); |
| 48 | } |
|
| 49 | ||
| 50 | public boolean equals(Object obj) { |
|
| 51 | ||
| 52 | 1156 | if (obj instanceof AuthenticatorKey) { |
| 53 | 1156 | return |
| 54 | ((AuthenticatorKey) obj).workingContext.equals(workingContext) && |
|
| 55 | ((AuthenticatorKey) obj).locationId.equals(locationId); |
|
| 56 | } else { |
|
| 57 | 0 | return false; |
| 58 | } |
|
| 59 | } |
|
| 60 | ||
| 61 | public String toString() { |
|
| 62 | 0 | return "[wc:" + workingContext + ", id:" + locationId + "]"; |
| 63 | } |
|
| 64 | ||
| 65 | } |
| This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |