1 17 package org.apache.servicemix.jbi.framework; 18 19 import java.io.Externalizable ; 20 import java.io.IOException ; 21 import java.io.ObjectInput ; 22 import java.io.ObjectOutput ; 23 24 29 public class ComponentNameSpace implements Externalizable { 30 31 34 private static final long serialVersionUID = -9130913368962887486L; 35 36 protected String containerName; 37 protected String name; 38 39 42 public ComponentNameSpace() { 43 } 44 45 52 public ComponentNameSpace(String containerName, String componentName) { 53 this.containerName = containerName; 54 this.name = componentName; 55 } 56 57 60 public String getName() { 61 return name; 62 } 63 64 67 public void setName(String componentName) { 68 this.name = componentName; 69 } 70 71 74 public String getContainerName() { 75 return containerName; 76 } 77 78 81 public void setContainerName(String containerName) { 82 this.containerName = containerName; 83 } 84 85 89 public boolean equals(Object obj) { 90 boolean result = false; 91 if (obj != null && obj instanceof ComponentNameSpace) { 92 ComponentNameSpace other = (ComponentNameSpace) obj; 93 result = other.containerName.equals(this.containerName) 94 && other.name.equals(this.name); 95 } 96 return result; 97 } 98 99 102 public int hashCode() { 103 return containerName.hashCode() ^ name.hashCode(); 104 } 105 106 109 public String toString() { 110 return "[container=" + containerName + ",name=" + name + "]"; 111 } 112 113 118 public void writeExternal(ObjectOutput out) throws IOException { 119 out.writeUTF(containerName != null ? containerName : ""); 120 out.writeUTF(name != null ? name : ""); 121 } 122 123 129 public void readExternal(ObjectInput in) throws IOException , ClassNotFoundException { 130 containerName = in.readUTF(); 131 name = in.readUTF(); 132 } 133 134 138 public ComponentNameSpace copy() { 139 ComponentNameSpace result = new ComponentNameSpace(containerName, name); 140 return result; 141 } 142 143 } 144 | Popular Tags |