public void define(String key, Class<?> type, Object value) {
        if (key == null) {
            throw new IllegalArgumentException("null key");
        }
        if (key.equals("")) {
            throw new IllegalArgumentException("key is an empty string");
        }
        if (type == null) {
            throw new IllegalArgumentException("type is null");
        }
        if (value != null && !type.isInstance(value)) {
            throw new IllegalArgumentException(
                   "value " + value + " is not a " + type.getName());
        }
        entries.put(key, new Entry(type, value));
    }