Actually, the distributed object event name is the normal DObject field name

(inStudlyFormat), it's just the constant that we use to reference that field in
code that's upper case. So we need to convert those as well. And I moved that
code into a documented method.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3884 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2006-02-23 19:01:15 +00:00
parent ff098a9394
commit 6d9d71256f
@@ -175,7 +175,7 @@ public abstract class ConfigRegistry
public void attributeChanged (AttributeChangedEvent event)
{
// mirror this configuration update to the persistent config
String key = event.getName().toLowerCase();
String key = nameToKey(event.getName());
Object value = event.getValue();
if (value instanceof Boolean) {
setValue(key, ((Boolean)value).booleanValue());
@@ -212,7 +212,7 @@ public abstract class ConfigRegistry
* its corresponding value in the associated config repository. */
protected void initField (Field field)
{
String key = StringUtil.unStudlyName(field.getName()).toLowerCase();
String key = nameToKey(field.getName());
Class type = field.getType();
try {
@@ -288,13 +288,22 @@ public abstract class ConfigRegistry
}
}
/**
* Converts a config object field name (someConfigMember) to a
* configuration key (some_config_member).
*/
protected String nameToKey (String attributeName)
{
return StringUtil.unStudlyName(attributeName).toLowerCase();
}
/**
* Get the specified attribute from the configuration object, and
* serialize it.
*/
protected void serializeAttribute (String attributeName)
{
String key = StringUtil.unStudlyName(attributeName).toLowerCase();
String key = nameToKey(attributeName);
Object value;
try {
value = object.getAttribute(attributeName);