Closed mttkay closed 11 years ago
Looking closer, I think this might be because when using the single argument version of createModel, a default reference model is first created using erector.createNewInstance.
I think if no reference object is supplied, no reference object should be used.
The way it works right now, the reference model is used to get the values for the newly created model. If a reference is not passed in, one is created. For the ModelFactory to work, it requires an instance of the object to apply the blueprint to.
The ModelFactory could be retooled so that it uses the created model as the reference, if a reference is not passed in.
Thanks Michael, I might look into this actually.
I'm using a constructor callback to generate consecutive model IDs in running order. However, I observed weird jumps between generated IDs. I debugged into the constructor callback and noticed that it's called multiple times for the same call to modelFactory.createModel.
I think a blueprint's constructor callback for the blueprinted model should only be called once per invocation of createModel.