Refactor so getter/setters can be overwritten.

Added write_serialized_typed_attribute and read_serialized_typed_attribute
instance methods, which are called from the defined attribute accessors.