Is the last `if (value == null) value = configBag.get(preferredKey)` necessary? That will presumably only return non-null if configBag.containsKey was true earlier or if the deprecated key was promoted.
Or is this for type coercion, or some such?