1 5 package com.tc.object.walker; 6 7 public class MapEntryNode extends AbstractNode { 8 9 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 } 44 | Popular Tags |