in discovery/local/src/main/java/org/apache/aries/rsa/discovery/endpoint/PropertiesMapper.java [189:231]
private static Object instantiate(String type, String value) {
if ("String".equals(type)) {
return value;
}
value = value.trim();
String boxedType = null;
if ("long".equals(type)) {
boxedType = "Long";
} else if ("double".equals(type)) {
boxedType = "Double";
} else if ("float".equals(type)) {
boxedType = "Float";
} else if ("int".equals(type)) {
boxedType = "Integer";
} else if ("byte".equals(type)) {
boxedType = "Byte";
} else if ("char".equals(type)) {
boxedType = "Character";
} else if ("boolean".equals(type)) {
boxedType = "Boolean";
} else if ("short".equals(type)) {
boxedType = "Short";
}
if (boxedType == null) {
boxedType = type;
}
String javaType = "java.lang." + boxedType;
try {
if ("Character".equals(boxedType)) {
return value.charAt(0);
} else {
Class<?> cls = ClassLoader.getSystemClassLoader().loadClass(javaType);
Constructor<?> ctor = cls.getConstructor(String.class);
return ctor.newInstance(value);
}
} catch (Exception e) {
LOG.warn("Could not create Endpoint Property of type {} and value {}", type, value);
return null;
}
}