You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
classBean {
Stringname;
intlength;
}
classPropertiesimplementsSettingsHolder {
publicstaticfinalProperty<Bean> BEAN = newBeanProperty("bean", newBean());
// subpath of bean above!publicstaticfinalProperty<Integer> LENGTH = newIntegerProperty("bean.length", 5);
}
classMain {
publicvoidmain(String... args) {
SettingsManagermanager = newSettingsManager(resource, null, Properties.class);
Beanbean = manager.getProperty(Properties.BEAN); // e.g. Bean(name="hi", length=5)intlength = manager.getProperty(Properties.LENGTH); // 5// but now:manager.setProperty(Properties.BEAN, newBean("hello", -1));
manager.setProperty(Properties.LENGTH, 20);
// results in inconsistent state (which cannot be exported in a sensible manner):manager.getProperty(Properties.BEAN); // returns Bean(name="hello", length=-1)manager.getProperty(Properties.LENGTH); // returns 20
}
}
This can be handled in a few ways:
somehow keep track of "bean paths" and throw if there is a property like LENGTH which is in a "bean path." Need to keep all paths as we may encounter LENGTH before BEAN. This could be done in ConfigurationDataBuilder, which would work out quite well.
provide a validation tool that handles this and more. Relies on the user knowing about it and running it to validate his config...
do nothing concerning this; if such a case happens we just don't guarantee that it works
I like the first point because we could validate in general that there are no path conflicts (for any types, property at path path and a property at path path.subpath are a conflict).
The text was updated successfully, but these errors were encountered:
Right now, it's possible to do this:
This can be handled in a few ways:
I like the first point because we could validate in general that there are no path conflicts (for any types, property at path
path
and a property at pathpath.subpath
are a conflict).The text was updated successfully, but these errors were encountered: