Class represents a dynamically typesafe view of the specified map entry.
| 3241 | * entry. |
| 3242 | */ |
| 3243 | private static class CheckedEntry<K, V> implements Map.Entry<K, V> { |
| 3244 | |
| 3245 | Map.Entry<K, V> e; |
| 3246 | |
| 3247 | Class<V> valueType; |
| 3248 | |
| 3249 | /** |
| 3250 | * Constructs a dynamically typesafe view of the specified map |
| 3251 | * entry. |
| 3252 | * |
| 3253 | * @param e |
| 3254 | * the map entry for which a dynamically typesafe view is |
| 3255 | * to be constructed. |
| 3256 | * @param valueType |
| 3257 | * the type of the value |
| 3258 | */ |
| 3259 | public CheckedEntry(Map.Entry<K, V> e, Class<V> valueType) { |
| 3260 | if (e == null) { |
| 3261 | throw new NullPointerException(); |
| 3262 | } |
| 3263 | this.e = e; |
| 3264 | this.valueType = valueType; |
| 3265 | } |
| 3266 | |
| 3267 | /** |
| 3268 | * @see java.util.Map.Entry#getKey() |
| 3269 | */ |
| 3270 | public K getKey() { |
| 3271 | return e.getKey(); |
| 3272 | } |
| 3273 | |
| 3274 | /** |
| 3275 | * @see java.util.Map.Entry#getValue() |
| 3276 | */ |
| 3277 | public V getValue() { |
| 3278 | return e.getValue(); |
| 3279 | } |
| 3280 | |
| 3281 | /** |
| 3282 | * @see java.util.Map.Entry#setValue(Object) |
| 3283 | */ |
| 3284 | public V setValue(V obj) { |
| 3285 | return e.setValue(checkType(obj, valueType)); |
| 3286 | } |
| 3287 | |
| 3288 | /** |
| 3289 | * @see java.util.Map.Entry#equals(Object) |
| 3290 | */ |
| 3291 | @Override |
| 3292 | public boolean equals(Object obj) { |
| 3293 | return e.equals(obj); |
| 3294 | } |
| 3295 | |
| 3296 | /** |
| 3297 | * @see java.util.Map.Entry#hashCode() |
| 3298 | */ |
| 3299 | @Override |
| 3300 | public int hashCode() { |
nothing calls this directly
no outgoing calls
no test coverage detected