[
https://issues.apache.org/jira/browse/WICKET-6550?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16444746#comment-16444746
]
Jezza commented on WICKET-6550:
-------------------------------
Or if that isn't the direction we want to go in, the current state still lets
us do something like:
{code:java}
public static <T> T computeIfAbsent(IMetadataContext<? super T, ?> context,
MetaDataKey<T> key, Supplier<T> supplier) {
T data = context.getMetaData(key);
if (data == null) {
data = supplier.get();
context.setMetaData(key, data);
}
return data;
}
{code}
> Unify all metadata capable objects.
> -----------------------------------
>
> Key: WICKET-6550
> URL: https://issues.apache.org/jira/browse/WICKET-6550
> Project: Wicket
> Issue Type: Improvement
> Components: wicket
> Reporter: Jezza
> Priority: Minor
> Attachments: Test.java, mock.txt
>
>
> Application, Session, RequestCycle, and Component all have #setMetadata and
> #getMetadata methods, but lack some super object to unify them all.
> These leads to annoying complex code if you wish to implement some basic
> functionality.
> Such as a computeIfAbsent, which needs to be implemented 4 times.
> I propose that we unify them all with one interface.
> I'veĀ attached a mock idea that would solve it, and I'll work on a prototype
> and submit a PR so anyone can take a look.
> I'll add a comment here with the PR number.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)