| 1 |
import java.util.HashMap; |
| 2 |
|
| 3 |
class MyClass { |
| 4 |
|
| 5 |
public enum Primitive { |
| 6 |
Boolean ("Boolean"), |
| 7 |
Char ("Character"), |
| 8 |
Byte ("Byte"), |
| 9 |
Short ("Short"), |
| 10 |
Int ("Integer"), |
| 11 |
Long ("Long"), |
| 12 |
Float ("Float"), |
| 13 |
Double ("Double"); |
| 14 |
|
| 15 |
final String nameOfBoxedType; |
| 16 |
} |
| 17 |
|
| 18 |
static final HashMap<String, Primitive> unboxMap = new HashMap<String, Primitive>(); |
| 19 |
static { |
| 20 |
for(Primitive unboxedType : Primitive.values()) { |
| 21 |
unboxMap.put(unboxedType.nameOfBoxedType, unboxedType); |
| 22 |
} |
| 23 |
} |
| 24 |
|
| 25 |
} |