[ 
https://issues.apache.org/jira/browse/ISIS-2107?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16829449#comment-16829449
 ] 

ASF subversion and git services commented on ISIS-2107:
-------------------------------------------------------

Commit b1b64e5e336ec067f5d9ef3bf7bc3d4d70d1a9f4 in isis's branch refs/heads/v2 
from danhaywood
[ https://gitbox.apache.org/repos/asf?p=isis.git;h=b1b64e5 ]

ISIS-2107: allows ObjectAdapterMementos that represent enum instances to be 
instantiated.


> Allow enums to implement interfaces for choices.
> ------------------------------------------------
>
>                 Key: ISIS-2107
>                 URL: https://issues.apache.org/jira/browse/ISIS-2107
>             Project: Isis
>          Issue Type: Bug
>          Components: Core, Core: Viewer: Wicket
>    Affects Versions: 1.17.0
>            Reporter: Dan Haywood
>            Assignee: Dan Haywood
>            Priority: Minor
>             Fix For: 1.18.0
>
>
> The code we wanted to write was equivalent to:
> {code:java}
>     public Object act(
>             final INflLeague nflLeague,
>             final NflRegion nflRegion,
>             final NflTeamEntity nflTeam) {
>         nflPlayer.updateUsingEntity((NflLeague)nflLeague, nflRegion, nflTeam);
>         return this.nflPlayer;
>     }
>     public List<? extends INflLeague> choices0Act() {
>         return Arrays.asList(NflLeague.values());
>     }
>     ...
> {code}
> where NflLeague is an enum that implements INflLeague :
> {code:java}
> public interface INflLeague {
>     String getName();
> }
> {code}
> and
> {code:java}
> public enum NflLeague implements INflLeague {
>     AFC,
>     NFC;
>     @Override
>     public String getName() {
>         return name();
>     }
> }
> {code}
> There are two issues:
> * first, in the metamodel we don't introspect enums to recognise that a list 
> of NflLeague enum instances can be returned in the choices method returning 
> List<INflLeague> 
> * second, in the Wicket viewer the selection of the choicesPanel is based on 
> the type, and if an interface is used then it guesses a referencePanel rather 
> than ValueSelect2Panel that is normally used for enums.  The marshalling 
> logic for ReferencePanel assumes entities, and fails when handed a bunch of 
> scalar enums.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to