class MBeanValueConverter {

    public Object convertParameterValue(String parameterName, String type)
            throws NumberFormatException, UnhandledParameterTypeException {
        String[] valueList = parameterMap.get(parameterName);
        if (valueList == null || valueList.length == 0) return null;
        String value = valueList[0];
        if (value.equals("<null>")) return null;
        if (type.equals("java.lang.String")) return value;
        if (type.equals("boolean")) return Boolean.parseBoolean(value);
        if (type.equals("int")) return Integer.parseInt(value);
        if (type.equals("long")) return Long.parseLong(value);
        if (type.equals("float")) return Float.parseFloat(value);
        if (type.equals("double")) return Double.parseDouble(value);

        throw new UnhandledParameterTypeException("Cannot convert " + value + " into type " + type +
                " for parameter " + parameterName);
    }

    public  MBeanValueConverter(Map<String, String[]> parameterMap);

}