Is there a reason why defaultValue can't be null? Providing default values for all preferences is unintuitive ('' for a string instead of null) or for custom types can be quite difficult.