[
https://issues.apache.org/jira/browse/ISIS-1022?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Daniel Keir Haywood updated ISIS-1022:
--------------------------------------
Component/s: (was: Isis Core)
Fix Version/s: (was: 2.11.0)
> Refactor IsisConverterLocator so that the converters are facets.
> ----------------------------------------------------------------
>
> Key: ISIS-1022
> URL: https://issues.apache.org/jira/browse/ISIS-1022
> Project: Isis
> Issue Type: Improvement
> Components: Isis Viewer Wicket
> Affects Versions: core-1.8.0
> Reporter: Daniel Keir Haywood
> Priority: Minor
>
> In ISIS-1012 we introduced the IsisConverterLocator class that inspects the
> ObjectSpecification and returns a suitable Wicket IConverter implementation.
> The implementation of this is a big switch statement.
> A better design would be for the IConverter to be made available through a
> suitable facet, probably as an extension of the existing ValueFacet. This
> would require updating the appropriate facet factories for all appropriate
> values.
> Note that we don't want Isis to have a dependency on Wicket, and so Isis
> would need to define its own "parallel" (copy of) IConverter, and have the
> ValueFacet return this.
> Then, in IsisConverterLocator, it would simply be a matter of adapting the
> Isis' IConverter into a Wicket IConverter.
> The final implementation of IsisConverterLocator would be something like:
> {code}
> final ObjectSpecification objectSpecification =
> objectAdapter.getSpecification();
> ValueFacet vf = objectSpecification.getFacet(ValueFacet.class)
> if(vf == null) { return null; }
> final org.apache.isis.core.metamodel.IConverter ic = vf.getConverter();
> if (ic == null) { return null; }
> return new org.apache.wicket.util.convert.IConverter() {
> public Object convertToObject(String value, Locale locale) {
> return ic.convertToObject(value, locale);
> }
> public String convertToString(C value, Locale locale) {
> return ic.convertToString(value, locale);
> }
> };
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)