propValue = propString.substring(sep2 + 1, propString .length()); properties.addProperty(new ConfigProperties.Property( propString.substring(0, sep1), propType, (propValue.equals("null") ? null
public static ConfigProperties toProperties(PropertiesInfo propertiesInfo) throws ManagementConsoleException { ConfigProperties properties = new ConfigProperties(); for (String key : propertiesInfo.keySet()) { String[] nameAndType = key.split(" :: ", 2); // obtain a value depending on the type of property //String value = propertiesInfo.getProperty(key); Object value = propertiesInfo.getProperty(key); try { Class clazz = Class.forName(nameAndType[1]); Constructor con = clazz.getConstructor(String.class); value = con.newInstance((String)value); } catch (Exception e) { throw new ManagementConsoleException("Value of " + nameAndType[0] + " is not supported for type " + nameAndType[1] + "."); } Property property = new Property(nameAndType[0], nameAndType[1], value); properties.addProperty(property); } return properties; } }
String propertyType = property.getAttribute("type"); String propertyValue = property.getAttribute("value"); props.addProperty(new ConfigProperties.Property( propertyName, propertyType, ConfigProperties.Property.toObject(propertyType,
.getProperties()) { if (newProperties.getProperty(configProperty.getName()) == null) { newProperties.addProperty(configProperty);
/** * Creates an instance of the {@link ConfigProperties} for this component * * @return */ public ConfigProperties getDefaultConfigPropertiesInstance() { ConfigProperties defaultProperties = new ConfigProperties(); for (ConfigPropertyDescriptor mConfigProperty : getDescriptor().getConfigProperties()) { Object configPropertyValue = mConfigProperty.getConfigPropertyValue() == null ? null : ConfigProperties.Property.toObject(mConfigProperty.getConfigPropertyType(), mConfigProperty .getConfigPropertyValue()); defaultProperties.addProperty(new ConfigProperties.Property(mConfigProperty.getConfigPropertyName(), mConfigProperty.getConfigPropertyType(), configPropertyValue)); } return defaultProperties; }