Я создаю пользовательский файл свойств в Java 1.8, я могу читать его лежащие свойства, но я хочу получить этот файл свойств с объектом complextype. Я не хочу читать по ключу и значению, я хочу привести егопрямо к объекту, как я могу это сделать
//Connection properties is my custom properties file class
prop = new Properties();
String filename = "connection.properties";
input = ConnectionProperties.class.getClassLoader().getResourceAsStream(filename);
if(input==null){
System.out.println("Sorry, unable to find " + filename);
return;
}
//load a properties file from class path, inside static method
prop.load(input);
Enumeration<?> e = prop.propertyNames();
while (e.hasMoreElements()) {
String key = (String) e.nextElement();
String value = prop.getProperty(key);
System.out.println("Key : " + key + ", Value : " + value);
}