@Override public Map<String, String> convert(String string, Type type) { return Utils.parseParams(string); }
@Override public Object convert(String string, Type type) { int index = string.indexOf(' '); if (index < 0) { return instantiate(string, null); } else { Map<String, String> properties = Utils.parseParams(string.substring(index + 1)); ComplexDefinition definition = new ComplexDefinition(); for (Map.Entry<String, String> property : properties.entrySet()) { definition.add(property.getKey(), new SimpleDefinition(property.getValue(), SimpleDefinition.Source.TEXT)); } return instantiate(string.substring(0, index), definition); } }
public static <T> T instantiateAndInit(String className, String params) { T instance = instantiate(className); if (params != null) { PropertyHelper.setProperties(instance, parseParams(params), false, false); } InitHelper.init(instance); return instance; }