1 26 27 package org.objectweb.util.explorer.core.naming.lib; 28 29 import org.objectweb.util.explorer.ExplorerUtils; 30 import org.objectweb.util.explorer.api.Context; 31 import org.objectweb.util.explorer.api.Entry; 32 33 34 40 public class DefaultEntry 41 implements Entry 42 { 43 44 50 51 protected Object name_; 52 53 54 protected Object value_; 55 56 57 protected Context wrapper_; 58 59 65 78 public DefaultEntry(Object name, Object value) { 79 name_ = name; 81 setValue(value); 82 } 83 84 90 protected boolean equals(DefaultEntry entry){ 91 if (entry!=null){ 92 return (this==entry) 93 || (ExplorerUtils.compareObjects(name_, entry.name_) 94 && ExplorerUtils.compareObjects(value_, entry.value_)); 95 } 96 return false; 97 } 98 99 105 108 public Object getValue() { 109 return value_; 110 } 111 112 115 public void setName(Object name) { 116 this.name_ = name; 117 } 118 119 122 public void setValue(Object value) { 123 this.value_ = value; 124 if(value!=null && value instanceof Context){ 125 wrapper_ = (Context)value; 126 } 127 } 128 129 132 public Object getName() { 133 return name_; 134 } 135 136 139 public Context getWrapper() { 140 return wrapper_; 141 } 142 143 146 public void setWrapper(Context wrapper) { 147 this.wrapper_ = wrapper; 148 } 149 150 156 171 public boolean equals(Object o){ 172 if(o!=null && o instanceof DefaultEntry) 173 return equals((DefaultEntry)o); 174 return false; 175 } 176 177 180 public String toString(){ 181 return "DefaultEntry[" + 182 "name=" + ExplorerUtils.toString(name_) + 183 ", value=" + value_ + 184 "]"; 185 } 186 187 191 public int hashCode(){ 192 return ExplorerUtils.getHashCode(name_) 193 + ExplorerUtils.getHashCode(value_); 194 } 195 } 196 | Popular Tags |