yea that looks good. I would say we dont need to be explicit about the equality comparator so that can be optional (default to Object.equals()). And if we want to make it explicit--it could even be an ognl expression, example: "ognl:#this.hashCode() == java.lang.System@identityHashCode()"
but that's a perfect start for us for the flyweight. What are your thoughts on using an xml parsing framework like dom4j? It's a bit tedious to do everything with dom (though makes JO lightweight and more portable).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
So the original XML Structure in the code (which we can just use from a starting point)
<object-profile name="patternSample" metaphor="testPatternSample">
<design-pattern>singleton</design-pattern>
<classes> <class>com.wideplay.Singleton</class>
</classes>
</object-profile>
Then i suggested something similar to (i know this doesn't have any context to the flyweight yet)
<object-profile name="patternSample" metaphor="testPatternSample">
<singleton>
<class>test.Singleton</class>
<!-- Allow changes to which method gets an instance -->
<instanceOf>getInstance</instanceOf>
</singleton>
</object-profile>
Another suggestion was something similar to how spring handles properties of objects...
<object-profile name="patternSample" metaphor="testPatternSample">
<singleton class="test.Singleton">
<property name="instanceOf">getInstance</property>
</singleton>
</object-profile>
I know you had suggested a namespace in your previous examples that can of course be added simply.
so finally for the flyweight we would be looking at something similar to this in my mind (this of course needs refining probably)....
<object-profile name="patternSample" metaphor="testPatternSample">
<flyweight class="test.FlyWeight">
<property name="equalityComparator">equals</property>
</flyweight>
</object-profile>
yea that looks good. I would say we dont need to be explicit about the equality comparator so that can be optional (default to Object.equals()). And if we want to make it explicit--it could even be an ognl expression, example: "ognl:#this.hashCode() == java.lang.System@identityHashCode()"
but that's a perfect start for us for the flyweight. What are your thoughts on using an xml parsing framework like dom4j? It's a bit tedious to do everything with dom (though makes JO lightweight and more portable).
Dom4j is fine. I have no real preference. Its good because it is contained in one jar with few other dependencies.
ok I will keep the dom4j conversion on the back burner, while we get pattern support going (atleast in junit tests).