Currently when an Entity wants to populate its children entities and policies, this is done in a method such as:
postConstruct() {
addChild(MySqlNode.class); //for example, like above
}
(Externally, e.g. as parent, you can add children to a child using the spec, but I'm talking when you are
implementing an Entity or the root Application, e.g. by subclassing Abstract{Entity,Application}
.)
The concern is that the name postConstruct
is obscure. It has a deliberate relationship with @javax.annotation.PostConstruct
-- the same semantics, namely it is made available internally for finishing construction of the object before making it available externally (leaking it). But it is not @PostConstruct
nor is it a friendly and obvious method for where someone implementing an Entity is going to do a large chunk of their work.
We have a few suggestions so far:
-
Rename it
construct()
-- this is what we are doing, in a meta sense: constructing the Entity, its children, policies, etc. however there is confusion with object construction as quite clearly this isn't a constructor! -
Rename it
populate()
-- AFAIK this isn't an overloaded term, and slightly less obscure -
Use
@PostConstruct
-- familiar to EE users, but we (so far) have not used annotations, as they quickly become confusing especially when you are trying to enforce an order, or trying to step through code using and IDE (note that 3 could be used with 1 or 2 as a default)
Thoughts? Better ideas?