1 9 package org.jboss.remoting.detection; 10 11 import java.io.Serializable ; 12 import org.jboss.remoting.InvokerLocator; 13 import org.jboss.remoting.ident.Identity; 14 15 22 public class Detection implements Serializable 23 { 24 static final long serialVersionUID = -7560953564286960592L; 25 26 private final ServerInvokerMetadata[] serverInvokers; 27 private final Identity identity; 28 private final int hashCode; 29 30 public Detection(Identity identity, ServerInvokerMetadata[] serverInvokers) 31 { 32 this.serverInvokers = serverInvokers; 33 this.identity = identity; 34 this.hashCode = identity.hashCode(); 35 } 36 37 public boolean equals(Object obj) 38 { 39 if(obj instanceof Detection) 40 { 41 return hashCode == obj.hashCode(); 42 } 43 return false; 44 } 45 46 public int hashCode() 47 { 48 return hashCode; 49 } 50 51 public String toString() 52 { 53 return "Detection [identity:" + identity + ",locators:" + (serverInvokers == null ? 0 : serverInvokers.length) + "]"; 54 } 55 56 61 public final Identity getIdentity() 62 { 63 return identity; 64 } 65 66 71 public final InvokerLocator[] getLocators() 72 { 73 InvokerLocator[] locators = new InvokerLocator[serverInvokers.length]; 74 for(int x = 0; x < serverInvokers.length; x++) 75 { 76 locators[x] = serverInvokers[x].getInvokerLocator(); 77 } 78 return locators; 79 } 80 81 88 public final ServerInvokerMetadata[] getServerInvokers() 89 { 90 return serverInvokers; 91 } 92 } 93 | Popular Tags |