use of com.servoy.j2db.util.OpenProperties in project servoy-client by Servoy.
the class ComponentFactory method parseJSonProperties.
public static <T> Map<String, T> parseJSonProperties(String properties) throws IOException {
if (properties == null || properties.length() <= 0) {
return null;
}
if (properties.startsWith("{")) {
// new format: json
try {
return new JSONWrapperMap<T>(new ServoyJSONObject(properties, false, true, false));
} catch (JSONException e) {
Debug.error(e);
throw new IOException();
}
}
// old format: OpenProperties
OpenProperties props = new OpenProperties();
props.load(new StringReader(properties));
return (Map<String, T>) props;
}
Aggregations