01: /*
02: * All content copyright (c) 2003-2007 Terracotta, Inc., except as may otherwise be noted in a separate copyright
03: * notice. All rights reserved.
04: */
05: package com.tc.object.walker;
06:
07: public class MapEntryNode extends AbstractNode {
08:
09: private final Object key;
10: private final Object value;
11: private int nextCount = 0;
12:
13: public MapEntryNode(MapEntry entry) {
14: super (entry);
15: key = entry.getKey();
16: value = entry.getValue();
17: }
18:
19: public boolean done() {
20: return nextCount > 1;
21: }
22:
23: public MemberValue next() {
24: final MemberValue rv;
25:
26: switch (nextCount) {
27: case 0: {
28: rv = MemberValue.mapKey(key);
29: break;
30: }
31: case 1: {
32: rv = MemberValue.mapValue(value);
33: break;
34: }
35: default:
36: throw new IllegalStateException();
37: }
38:
39: nextCount++;
40: return rv;
41: }
42:
43: }
|