[osmosis-dev] API 0.6 and unique keys
brett at bretth.com
Wed Jan 28 12:26:08 GMT 2009
marcus.wolschon at googlemail.com wrote:
> On Wed, 28 Jan 2009 23:02:28 +1100, Brett Henderson <brett at bretth.com>
>> Have you tried the EntityBuilder classes? They were intended to make
>> this easier, or at least require less code. The builder classes can be
>> used in place of normal entity classes where you require a mutable
>> object and only convert them to a true entity at the interface of your
>> task. It is something of an experiment though. If they're never useful
>> then I might scrap the idea. I've used them in a number of places
>> within the core osmosis tasks. The database code uses them extensively
>> because the code that reads basic entities is quite separate from the
>> code that reads tags, way nodes, etc so it's useful to be able to build
>> an entity up in stages.
> I did not know about them.
> I'll have a look. It sounds very usefull. :)
This was my initial response to the whole "mutable" versus "immutable"
entity discussion. I was hoping that by creating builders to simplify
entity manipulation that we could have it both ways, easy to modify
entities, and guaranteed thread safety. But I don't know if it was a
good idea or not. I think it's fairly neat, but is definitely more
complex than just allowing entities to be modified directly. It also
incurs a performance penalty (although fairly small according to the
performance stats I posted recently). Feedback most welcome.
An example of their use is in the TagRemoverBuilder class.
More information about the osmosis-dev