yamlbeans
yamlbeans copied to clipboard
request for automatic detection of parameterized List's
If we have:
public class Machines {
public List<Machine> machines;
}
public class Machine {
public String machine_used;
public List<Measurement> measurements;
}
I have to say:
yamlConfig.setPropertyElementType(Machines.class, "machines", Machine.class);
yamlConfig.setPropertyElementType(Machine.class, "measurements", Measurement.class);
Couldn't yamlbeans conceivably use the generic parameter of the List as a safe default?
I can submit a pull request, if it has a decent chance of getting accepted. :)
Yes, it could. A PR would be merged if the changes are relatively small. You can see how JsonBeans does it. Supporting only a single generic type like that is reasonable, I don't think it's worth the complexity to do more.
I would certainly vote for that feature!