Hi all,
I am working on the categories.
I think we all agree that this should have a nice API since every rule
will work with that, directly or indirectly.
We will get more metadata, and "hiding" them into various places,
untyped hashmaps of lists of strings, really seems like a bad way to do it.
After some work on the subject, I think we should abandon the current
unfortunate approach of Rules acting like a map through being a Rule and
Context at the same time, needing conditional retyping. And the other
way of overriding methods like enhanceMetadata() is not fortunate either
as every subclass needs to be aware of what's going on in the superclasses.
Instead, we should follow the *conventions*, take the *standard*
approach, and let Rules have a normal getMetadata(), which would return
an object with all the metadata at one place. This could be subclassed
to match the needs of individual addons but provide type-safe and
easy-to-use API for shared metadata.
getPhase(), getExecute*(), getCategories() etc. could
a) still return what they return, being executed by the loader as now,
and put to that object, or
b) let the rule initialize this object in rule's init() (which we don't
have) or a construtor;
I would drop get*() but we could tunel them to that object for
backwards compatibility.
I think this goes beyond the scope of Windup and would need a rewrite of
Rewrite (well, not real rewrite, but I liked the pun :).
Other option is to keep scattering metadata in various places, untyped
hashmaps of lists of strings. Not recommended.
WDYT?
Ondra