On 01/08/2011 05:16 PM, Jeremy Thomerson wrote:
Not all that amazing.  This is happening*during construction*  which always
leaves objects in fragile states.  It's assumed that you can't start
monkeying around with an object's state until construction is completed (and
not expect side effects).

From the ResourceModelTest.java

  IModel model = new ResourceModel("test.label");

Model is constructed.
Can you call model.getObject() yet? No.

  Label l = new Label("testlabel", model);

Component containing Model is constructed.
Can you call model.getObject() yet? No.

  add(l);

Parent Component containing Component which contains
the Model is constructed.
Can you call model.getObject() yet? Finally, Yes.

If the advice to a user is to not print any debugging information about
any state until the application is completely constructed, then, that,
in generally, really would be amazing.
I think ResourceModel is a special case that depends upon being is
a fully constructed Component tree. Just as a Model which communicates
with a DB can not be interrogated until its connected to the DB.

As an addition, if such pieces that require some level of supporting infrastructure prior to interrogation had comments warning the
user that they needed special care, most users would not remember
such admonishments while adding general debugging statements
(especially, if
the object in question (a Model) was one of a number of such types
of objects (Models) where most of the types are safe under examination.)


Richard
--
Quis custodiet ipsos custodes

Reply via email to