1 16 package com.google.gwt.user.rebind; 17 18 import java.util.Map ; 19 20 24 class Enum { 25 32 public static Enum require(String key, Map pool) { 33 Enum t = (Enum ) pool.get(key); 34 if (t == null) { 35 throw new IllegalArgumentException (key 36 + " is not a valid Enum type. Current options are " + pool.keySet()); 37 } 38 return t; 39 } 40 41 44 final String key; 45 46 52 protected Enum(String key, Map pool) { 53 this.key = key; 54 pool.put(key, this); 55 } 56 57 60 public String toString() { 61 return key; 62 } 63 } | Popular Tags |