or builder pattern:
AttributeModifier.attr("name").model(someModel).create().append()
On Wed, Jun 8, 2011 at 12:27 PM, Martijn Dashorst
<[email protected]> wrote:
> Taken from the user@ list, where it might get snowed under...
>
> The SimpleAttributeModifier, AttributeAppender and AttributePrepender
> classes are in my opinion stop gap measures to work around issues with
> AttributeModifier's API.
>
> I think that we could do better API wise with three factory methods (or 6 if
> we duplicate each method to take an IModel<?> and a String for
> convenience) on AttributeModifier, and deprecate SimpleAttributeModifier
> and AttributeAppender. I'd also merge the appender/prepender logic into
> attribute modifier, such that user specializations can make use of
> them.
>
> AttributeModifier.setAttribute(String attribute, IModel<?> value);
> AttributeModifier.setAttribute(String attribute, String value);
> AttributeModifier.prependAttribute(String attribute, String value);
> AttributeModifier.prependAttribute(String attribute, IModel<?> value);
> AttributeModifier.appendAttribute(String attribute, String value);
> AttributeModifier.appendAttribute(String attribute, IModel<?> value);
>
> Or perhaps:
>
> AttributeModifier.overwrite(String attribute, IModel<?> value);
> AttributeModifier.overwrite(String attribute, String value);
> AttributeModifier.prepend(String attribute, IModel<?> value);
> AttributeModifier.prepend(String attribute, String value);
> AttributeModifier.append(String attribute, IModel<?> value);
> AttributeModifier.append(String attribute, String value);
>
> I'd value input on the naming of things.
>
> Martijn
>
--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com