1 17 18 package org.apache.geronimo.core.service; 19 20 import java.io.Externalizable ; 21 import java.io.IOException ; 22 import java.io.ObjectInput ; 23 import java.io.ObjectOutput ; 24 25 import org.apache.geronimo.core.service.InvocationKey; 26 27 30 public class StringInvocationKey implements InvocationKey, Externalizable { 31 32 private String key; 33 private boolean isTransient; 34 private int hashCode; 35 36 public StringInvocationKey(String key, boolean isTransient) { 37 this.key = key; 38 this.hashCode = key.hashCode(); 39 this.isTransient = isTransient; 40 } 41 42 45 public boolean isTransient() { 46 return isTransient; 47 } 48 49 52 public int hashCode() { 53 return hashCode; 54 } 55 56 59 public boolean equals(Object obj) { 60 if( obj == null ) 61 return false; 62 if( !StringInvocationKey.class.equals(obj.getClass()) ) 63 return false; 64 return key.equals( ((StringInvocationKey)obj).key ); 65 } 66 67 70 public void writeExternal(ObjectOutput out) throws IOException { 71 out.writeUTF(key); 72 } 73 74 77 public void readExternal(ObjectInput in) throws IOException , ClassNotFoundException { 78 key = in.readUTF(); 79 hashCode = key.hashCode(); 80 isTransient = false; 81 } 82 83 86 public String toString() { 87 return key; 88 } 89 } 90 | Popular Tags |