| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| Target |
|
| 3.0;3 |
| 1 | package org.jscsi.target; | |
| 2 | ||
| 3 | ||
| 4 | import org.jscsi.target.storage.IStorageModule; | |
| 5 | ||
| 6 | ||
| 7 | /** | |
| 8 | * One Target exists per iSCSI named target. Holds onto the name and the {@link IStorageModule} | |
| 9 | * | |
| 10 | * @author David L. Smith-Uchida | |
| 11 | * | |
| 12 | * jSCSI | |
| 13 | * | |
| 14 | * Copyright (C) 2009 iGeek, Inc. All Rights Reserved | |
| 15 | */ | |
| 16 | public class Target { | |
| 17 | private final String targetName; | |
| 18 | private final String targetAlias; | |
| 19 | private final IStorageModule storageModule; | |
| 20 | ||
| 21 | 0 | public Target (String targetName, String targetAlias, IStorageModule storageModule) { |
| 22 | 0 | this.targetName = targetName; |
| 23 | 0 | this.targetAlias = targetAlias; |
| 24 | 0 | this.storageModule = storageModule; |
| 25 | 0 | } |
| 26 | ||
| 27 | public String getTargetName () { | |
| 28 | 0 | return targetName; |
| 29 | } | |
| 30 | ||
| 31 | public String getTargetAlias () { | |
| 32 | 0 | return targetAlias; |
| 33 | } | |
| 34 | ||
| 35 | public IStorageModule getStorageModule () { | |
| 36 | 0 | return storageModule; |
| 37 | } | |
| 38 | ||
| 39 | @Override | |
| 40 | public int hashCode () { | |
| 41 | 0 | final int prime = 31; |
| 42 | 0 | int result = 1; |
| 43 | 0 | result = prime + ((targetName == null) ? 0 : targetName.hashCode()); |
| 44 | 0 | return result; |
| 45 | } | |
| 46 | ||
| 47 | @Override | |
| 48 | public boolean equals (Object obj) { | |
| 49 | 0 | if (this == obj) return true; |
| 50 | 0 | if (obj == null) return false; |
| 51 | 0 | if (getClass() != obj.getClass()) return false; |
| 52 | 0 | Target other = (Target) obj; |
| 53 | 0 | if (targetName == null) { |
| 54 | 0 | if (other.targetName != null) return false; |
| 55 | 0 | } else if (!targetName.equals(other.targetName)) return false; |
| 56 | 0 | return true; |
| 57 | } | |
| 58 | ||
| 59 | } |