Suppose I have a data structure like this:

`Map<DataType, Object> myMapLikeObject;`

```
public enum DataType {
    TRANSPARENT, PASSABLE, PASSAGE_COST; 
}

```

What I'm trying to achieve is to associate each enum constant with a data type like this:

```
public enum DataType {
    TRANSPARENT(Boolean.class),
    PASSABLE(Boolean.class),
    PASSAGE_COST(Integer.class); 
}

```

so if I try to `myMap.put(DataType.TRANSPARENT, "someStuff");` I can validate the input and throw an exception because it is not a `Boolean`. This works so far but it leads to runtime errors.

How can I write code that will result in a compile-time error with calls like this:
`myMap.put(DataType.TRANSPARENT, "someStuff");` ?