[stringtemplate-interest] v4 model adaptor unit tests
Terence Parr
parrt at cs.usfca.edu
Fri Dec 24 12:23:40 PST 2010
Right so a Feature has both isPublic and isStatic so FeatureAdaptor should handle both, even if it delegates to another such as NamedElementAdaptor. :)
Ter
On Dec 23, 2010, at 6:18 PM, Rafael Chaves wrote:
> My concrete use case: adapting UML model elements. Consider the model
> class hierarchy:
>
> NamedElement
> Class
> Feature
> Property
> Operation
>
> - NamedElementAdaptor handles a "isPublic" property.
> - FeatureAdaptor handles a "isStatic" property.
> - OperationAdaptor handles a "hasParameters" property.
> - PropertyAdaptor handles an "initialValue" property.
>
> I don't want my adaptors to have to handle the case a property is
> natively supported by the object itself. And I would not want to have
> to handle "isPublic" in PropertyAdaptor.
>
> I guess I work around that on my side by making PropertyAdaptor extend
> FeatureAdaptor, which would extend NamedElementAdaptor, and implement
> the "passing up" that way (by calling super.getProperty() instead of
> failing). NamedElementAdaptor would actually extend your
> ObjectModelAdaptor (which would handle the reflection case and fail
> hard).
>
> Cheers,
>
> Rafael
More information about the stringtemplate-interest
mailing list