On 1 Feb 2006, at 13:40, Matthew Toseland wrote:
> Soon we will need config support for 0.7. The plan is to have the
> format
> roughly the same, but with some functional changes. However I think
> there are some unclear issues, so I am posting before I code it.
>
> Expected functional changes:
> - When you register a config option, you have to include a callback
> object. So most options will now be updatable on the fly, rather
> than
> the occasional option being updatable on the fly.
I think we would have an abstract class something like this that
would need to be implemented for each parameter:
public abstract class Parameter {
public abstract String getShortName();
public abstract String getLongName();
public abstract String getDescription();
public abstract Class getParamType();
public String getString() throws ClassCastException {
return (String) get();
}
public String getInt() throws ClassCastException {
return ((Integer) get()).intValue();
}
// ...Ditto for getting other types...
public abstract Object get();
public String getAsString() {
return get().toString();
}
public abstract void setToString(String value) throws
InvalidParameterException;
public abstract void set(Object value) throws
InvalidParameterException;
}
Implementations of this abstract class would then be registered with
the config/command-line system. The implementation of the set()
method will need to be smart enough to deal with being called more
than once.
> So I
> have come to the conclusion that the config file should be bare,
> with no
> comments whatsoever.
In the interests of expediency, I can agree to this - although we may
want to allow for comments in the future.
Ian.