Personally I would create a wrapper class that I could pass my properties file to when loading. This way I can have a generic class which handles all of the logic in the properties file, making it easy for later use.
For example this is what I use for saving paths in a x;y;z;x;y;z format:
import org.osbot.rs07.api.map.Position;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
/**
* Created with IntelliJ IDEA
* User: Anthony
* Date: 6/3/2014
*/
public class Path {
private String name;
private List<Position> path;
public Path(Properties properties) {
this.name = properties.getProperty("name");
this.path = getPathFromProperties(properties);
}
public String getName() {
return name;
}
public List<Position> getPath() {
return path;
}
@Override
public String toString() {
return name;
}
private List<Position> getPathFromProperties(Properties properties) {
List<Position> returnPath = new ArrayList<>();
for (String s : properties.getProperty("path").split(";")) {
String[] coords = s.split(",");
returnPath.add(new Position(Integer.parseInt(coords[0]), Integer.parseInt(coords[1]), Integer.parseInt(coords[2])));
}
return returnPath;
}
}